Avoid use of goto

This commit is contained in:
Kovid Goyal
2020-04-29 14:37:26 +05:30
parent e5d50aca6d
commit b541341681

View File

@@ -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
}
// }}}