Avoid use of goto
This commit is contained in:
14
kitty/glfw.c
14
kitty/glfw.c
@@ -323,17 +323,17 @@ window_focus_callback(GLFWwindow *w, int focused) {
|
|||||||
static int
|
static int
|
||||||
drop_callback(GLFWwindow *w, const char *mime, const char *data, size_t sz) {
|
drop_callback(GLFWwindow *w, const char *mime, const char *data, size_t sz) {
|
||||||
if (!set_callback_window(w)) return 0;
|
if (!set_callback_window(w)) return 0;
|
||||||
|
#define RETURN(x) { global_state.callback_os_window = NULL; return x; }
|
||||||
if (!data) {
|
if (!data) {
|
||||||
if (strcmp(mime, "text/uri-list") == 0) return 3;
|
if (strcmp(mime, "text/uri-list") == 0) RETURN(3);
|
||||||
if (strcmp(mime, "text/plain;charset=utf-8") == 0) return 2;
|
if (strcmp(mime, "text/plain;charset=utf-8") == 0) RETURN(2);
|
||||||
if (strcmp(mime, "text/plain") == 0) return 1;
|
if (strcmp(mime, "text/plain") == 0) RETURN(1);
|
||||||
goto end;
|
RETURN(0);
|
||||||
}
|
}
|
||||||
WINDOW_CALLBACK(on_drop, "sy#", mime, data, (Py_ssize_t)sz);
|
WINDOW_CALLBACK(on_drop, "sy#", mime, data, (Py_ssize_t)sz);
|
||||||
request_tick_callback();
|
request_tick_callback();
|
||||||
end:
|
RETURN(0);
|
||||||
global_state.callback_os_window = NULL;
|
#undef RETURN
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
|
|||||||
Reference in New Issue
Block a user