mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
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
|
||||
drop_callback(GLFWwindow *w, const char *mime, const char *data, size_t sz) {
|
||||
if (!set_callback_window(w)) return 0;
|
||||
#define RETURN(x) { global_state.callback_os_window = NULL; return x; }
|
||||
if (!data) {
|
||||
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") == 0) return 1;
|
||||
goto end;
|
||||
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") == 0) RETURN(1);
|
||||
RETURN(0);
|
||||
}
|
||||
WINDOW_CALLBACK(on_drop, "sy#", mime, data, (Py_ssize_t)sz);
|
||||
request_tick_callback();
|
||||
end:
|
||||
global_state.callback_os_window = NULL;
|
||||
return 0;
|
||||
RETURN(0);
|
||||
#undef RETURN
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
Reference in New Issue
Block a user