mirror of
https://github.com/rkd77/elinks.git
synced 2024-10-13 05:43:37 -04:00
[event] union for const/non-const void *
This commit is contained in:
parent
feac3151f3
commit
cba95b2b30
@ -87,10 +87,10 @@ static enum evhook_status bookmark_change_hook(va_list ap, void *data);
|
||||
static enum evhook_status bookmark_write_hook(va_list ap, void *data);
|
||||
|
||||
struct event_hook_info bookmark_hooks[] = {
|
||||
{ C_("bookmark-delete"), 0, bookmark_change_hook, NULL },
|
||||
{ C_("bookmark-move"), 0, bookmark_change_hook, NULL },
|
||||
{ C_("bookmark-update"), 0, bookmark_change_hook, NULL },
|
||||
{ C_("periodic-saving"), 0, bookmark_write_hook, NULL },
|
||||
{ C_("bookmark-delete"), 0, bookmark_change_hook, {NULL} },
|
||||
{ C_("bookmark-move"), 0, bookmark_change_hook, {NULL} },
|
||||
{ C_("bookmark-update"), 0, bookmark_change_hook, {NULL} },
|
||||
{ C_("periodic-saving"), 0, bookmark_write_hook, {NULL} },
|
||||
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ goto_url_history_write_hook(va_list ap, void *data)
|
||||
}
|
||||
|
||||
static struct event_hook_info goto_url_history_hooks[] = {
|
||||
{ "periodic-saving", 0, goto_url_history_write_hook, NULL },
|
||||
{ "periodic-saving", 0, goto_url_history_write_hook, {NULL} },
|
||||
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
@ -425,7 +425,7 @@ global_history_write_hook(va_list ap, void *data)
|
||||
}
|
||||
|
||||
struct event_hook_info global_history_hooks[] = {
|
||||
{ "periodic-saving", 0, global_history_write_hook, NULL },
|
||||
{ "periodic-saving", 0, global_history_write_hook, {NULL} },
|
||||
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
@ -289,7 +289,7 @@ register_event_hooks(struct event_hook_info *hooks)
|
||||
if (id == EVENT_NONE) continue;
|
||||
|
||||
register_event_hook(id, hooks[i].callback, hooks[i].priority,
|
||||
hooks[i].data);
|
||||
hooks[i].adata);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,10 +79,13 @@ struct event_hook_info {
|
||||
const char *name;
|
||||
int priority;
|
||||
event_hook_T callback;
|
||||
void *data;
|
||||
union {
|
||||
const void *data;
|
||||
void *adata;
|
||||
};
|
||||
};
|
||||
|
||||
#define NULL_EVENT_HOOK_INFO { NULL, 0, NULL, NULL }
|
||||
#define NULL_EVENT_HOOK_INFO { NULL, 0, NULL, {NULL} }
|
||||
|
||||
void register_event_hooks(struct event_hook_info *hooks);
|
||||
void unregister_event_hooks(struct event_hook_info *hooks);
|
||||
|
@ -339,7 +339,7 @@ goto_url_hook(va_list ap, void *data)
|
||||
}
|
||||
|
||||
struct event_hook_info uri_rewrite_hooks[] = {
|
||||
{ "goto-url", -1, goto_url_hook },
|
||||
{ "goto-url", -1, goto_url_hook, {NULL} },
|
||||
|
||||
NULL_EVENT_HOOK_INFO
|
||||
};
|
||||
|
@ -184,10 +184,10 @@ script_hook_quit(va_list ap, void *data)
|
||||
}
|
||||
|
||||
struct event_hook_info guile_scripting_hooks[] = {
|
||||
{ "goto-url", 0, script_hook_goto_url, NULL },
|
||||
{ "follow-url", 0, script_hook_follow_url, NULL },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, NULL },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, NULL },
|
||||
{ "quit", 0, script_hook_quit, NULL },
|
||||
{ "goto-url", 0, script_hook_goto_url, {NULL} },
|
||||
{ "follow-url", 0, script_hook_follow_url, {NULL} },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, {NULL} },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, {NULL} },
|
||||
{ "quit", 0, script_hook_quit, {NULL} },
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
@ -235,12 +235,12 @@ script_hook_quit(va_list ap, void *data)
|
||||
}
|
||||
|
||||
struct event_hook_info lua_scripting_hooks[] = {
|
||||
{ "goto-url", 0, script_hook_goto_url, NULL },
|
||||
{ "follow-url", 0, script_hook_follow_url, NULL },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, NULL },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, NULL },
|
||||
{ "quit", 0, script_hook_quit, NULL },
|
||||
{ "dialog-lua-console", 0, dialog_lua_console, NULL },
|
||||
{ "free-history", 0, free_lua_console_history, NULL },
|
||||
{ "goto-url", 0, script_hook_goto_url, {NULL} },
|
||||
{ "follow-url", 0, script_hook_follow_url, {NULL} },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, {NULL} },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, {NULL} },
|
||||
{ "quit", 0, script_hook_quit, {NULL} },
|
||||
{ "dialog-lua-console", 0, dialog_lua_console, {NULL} },
|
||||
{ "free-history", 0, free_lua_console_history, {NULL} },
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
@ -237,10 +237,10 @@ script_hook_quit(va_list ap, void *data)
|
||||
}
|
||||
|
||||
struct event_hook_info perl_scripting_hooks[] = {
|
||||
{ "goto-url", 0, script_hook_goto_url, NULL },
|
||||
{ "follow-url", 0, script_hook_follow_url, NULL },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, NULL },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, NULL },
|
||||
{ "quit", 0, script_hook_quit, NULL },
|
||||
{ "goto-url", 0, script_hook_goto_url, {NULL} },
|
||||
{ "follow-url", 0, script_hook_follow_url, {NULL} },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, {NULL} },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, {NULL} },
|
||||
{ "quit", 0, script_hook_quit, {NULL} },
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
@ -144,7 +144,7 @@ script_hook_pre_format_html(va_list ap, void *data)
|
||||
struct fragment *fragment = get_cache_fragment(cached);
|
||||
char *url = struri(cached->uri);
|
||||
int codepage = get_codepage(cached->head);
|
||||
char *method = "pre_format_html_hook";
|
||||
const char *method = "pre_format_html_hook";
|
||||
struct session *saved_python_ses = python_ses;
|
||||
PyObject *result = NULL;
|
||||
int success = 0;
|
||||
@ -264,7 +264,7 @@ script_hook_get_proxy(va_list ap, void *data)
|
||||
{
|
||||
char **proxy = va_arg(ap, char **);
|
||||
char *url = va_arg(ap, char *);
|
||||
char *method = "proxy_for_hook";
|
||||
const char *method = "proxy_for_hook";
|
||||
PyObject *result;
|
||||
|
||||
evhook_use_params(proxy && url);
|
||||
@ -288,7 +288,7 @@ script_hook_get_proxy(va_list ap, void *data)
|
||||
static enum evhook_status
|
||||
script_hook_quit(va_list ap, void *data)
|
||||
{
|
||||
char *method = "quit_hook";
|
||||
const char *method = "quit_hook";
|
||||
PyObject *result;
|
||||
|
||||
if (!python_hooks || !PyObject_HasAttrString(python_hooks, method))
|
||||
@ -303,10 +303,10 @@ script_hook_quit(va_list ap, void *data)
|
||||
}
|
||||
|
||||
struct event_hook_info python_scripting_hooks[] = {
|
||||
{ "goto-url", 0, script_hook_url, "goto_url_hook" },
|
||||
{ "follow-url", 0, script_hook_url, "follow_url_hook" },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, NULL },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, NULL },
|
||||
{ "quit", 0, script_hook_quit, NULL },
|
||||
{ "goto-url", 0, script_hook_url, {"goto_url_hook"} },
|
||||
{ "follow-url", 0, script_hook_url, {"follow_url_hook"} },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, {NULL} },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, {NULL} },
|
||||
{ "quit", 0, script_hook_quit, {NULL} },
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
@ -247,11 +247,11 @@ script_hook_quit(va_list ap, void *data)
|
||||
}
|
||||
|
||||
struct event_hook_info ruby_scripting_hooks[] = {
|
||||
{ "goto-url", 0, script_hook_goto_url, NULL },
|
||||
{ "follow-url", 0, script_hook_follow_url, NULL },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, NULL },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, NULL },
|
||||
{ "quit", 0, script_hook_quit, NULL },
|
||||
{ "goto-url", 0, script_hook_goto_url, {NULL} },
|
||||
{ "follow-url", 0, script_hook_follow_url, {NULL} },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, {NULL} },
|
||||
{ "get-proxy", 0, script_hook_get_proxy, {NULL} },
|
||||
{ "quit", 0, script_hook_quit, {NULL} },
|
||||
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
@ -102,9 +102,9 @@ end:
|
||||
}
|
||||
|
||||
struct event_hook_info smjs_scripting_hooks[] = {
|
||||
{ "goto-url", 0, script_hook_url, "goto_url_hook" },
|
||||
{ "follow-url", 0, script_hook_url, "follow_url_hook" },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, NULL },
|
||||
{ "goto-url", 0, script_hook_url, {"goto_url_hook"} },
|
||||
{ "follow-url", 0, script_hook_url, {"follow_url_hook"} },
|
||||
{ "pre-format-html", 0, script_hook_pre_format_html, {NULL} },
|
||||
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
@ -2010,7 +2010,7 @@ search_history_write_hook(va_list ap, void *data)
|
||||
}
|
||||
|
||||
static struct event_hook_info search_history_hooks[] = {
|
||||
{ "periodic-saving", 0, search_history_write_hook, NULL },
|
||||
{ "periodic-saving", 0, search_history_write_hook, {NULL} },
|
||||
|
||||
NULL_EVENT_HOOK_INFO,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user