diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2016-03-21 18:11:21 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2016-03-21 18:11:21 +0100 |
commit | cf6aca1619c32422a43fa3d82e0674f6b7b49fe9 (patch) | |
tree | 65392ef12eab877f544fe306fe0abb98214ddebd /src/plugins/irc/irc-bar-item.c | |
parent | 6d764b64c50adb19309a9de14bfeafac648ab47a (diff) | |
download | weechat-cf6aca1619c32422a43fa3d82e0674f6b7b49fe9.zip |
core: add pointer in some callbacks (closes #406)
This pointer is the first argument received by callbacks, and the
existing argument "data" is now automatically freed by WeeChat when the
object containing the callback is removed.
With this new pointer, the linked list of callbacks in scripts has been
removed. This will improve speed of scripts (using a lot of hooks),
reduce memory used by scripts and reduce time to unload scripts.
Following functions are affected in the C API:
* exec_on_files
* config_new
* config_new_section
* config_new_option
* hook_command
* hook_command_run
* hook_timer
* hook_fd
* hook_process
* hook_process_hashtable
* hook_connect
* hook_print
* hook_signal
* hook_hsignal
* hook_config
* hook_completion
* hook_modifier
* hook_info
* hook_info_hashtable
* hook_infolist
* hook_hdata
* hook_focus
* unhook_all_plugin
* buffer_new
* bar_item_new
* upgrade_new
* upgrade_read
Diffstat (limited to 'src/plugins/irc/irc-bar-item.c')
-rw-r--r-- | src/plugins/irc/irc-bar-item.c | 69 |
1 files changed, 49 insertions, 20 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index 4c8f96e2f..fb599fb02 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -38,7 +38,8 @@ */ char * -irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item, +irc_bar_item_buffer_plugin (const void *pointer, void *data, + struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) @@ -50,6 +51,7 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item, struct t_irc_channel *channel; /* make C compiler happy */ + (void) pointer; (void) data; (void) item; (void) window; @@ -198,12 +200,14 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name) */ char * -irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item, +irc_bar_item_buffer_name (const void *pointer, void *data, + struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) { /* make C compiler happy */ + (void) pointer; (void) data; (void) item; (void) window; @@ -218,12 +222,14 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item, */ char * -irc_bar_item_buffer_short_name (void *data, struct t_gui_bar_item *item, +irc_bar_item_buffer_short_name (const void *pointer, void *data, + struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) { /* make C compiler happy */ + (void) pointer; (void) data; (void) item; (void) window; @@ -237,7 +243,8 @@ irc_bar_item_buffer_short_name (void *data, struct t_gui_bar_item *item, */ char * -irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item, +irc_bar_item_buffer_modes (const void *pointer, void *data, + struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) @@ -249,6 +256,7 @@ irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item, struct t_irc_channel *channel; /* make C compiler happy */ + (void) pointer; (void) data; (void) item; (void) window; @@ -297,7 +305,8 @@ irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item, */ char * -irc_bar_item_channel (void *data, struct t_gui_bar_item *item, +irc_bar_item_channel (const void *pointer, void *data, + struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) { @@ -308,6 +317,7 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item, struct t_irc_channel *channel; /* make C compiler happy */ + (void) pointer; (void) data; (void) item; (void) window; @@ -374,7 +384,8 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item, */ char * -irc_bar_item_lag (void *data, struct t_gui_bar_item *item, +irc_bar_item_lag (const void *pointer, void *data, + struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) { @@ -382,6 +393,7 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item, struct t_irc_server *server; /* make C compiler happy */ + (void) pointer; (void) data; (void) item; (void) window; @@ -413,7 +425,8 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item, */ char * -irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item, +irc_bar_item_input_prompt (const void *pointer, void *data, + struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) @@ -425,6 +438,7 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item, int length; /* make C compiler happy */ + (void) pointer; (void) data; (void) item; (void) window; @@ -494,7 +508,8 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item, */ char * -irc_bar_item_nick_modes (void *data, struct t_gui_bar_item *item, +irc_bar_item_nick_modes (const void *pointer, void *data, + struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) @@ -504,6 +519,7 @@ irc_bar_item_nick_modes (void *data, struct t_gui_bar_item *item, int length; /* make C compiler happy */ + (void) pointer; (void) data; (void) item; (void) window; @@ -533,7 +549,7 @@ irc_bar_item_nick_modes (void *data, struct t_gui_bar_item *item, */ struct t_hashtable * -irc_bar_item_focus_buffer_nicklist (void *data, +irc_bar_item_focus_buffer_nicklist (const void *pointer, void *data, struct t_hashtable *info) { long unsigned int value; @@ -555,6 +571,7 @@ irc_bar_item_focus_buffer_nicklist (void *data, IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ + (void) pointer; (void) data; if (ptr_server && ptr_channel) @@ -579,10 +596,12 @@ irc_bar_item_focus_buffer_nicklist (void *data, */ int -irc_bar_item_buffer_switch (void *data, const char *signal, +irc_bar_item_buffer_switch (const void *pointer, void *data, + const char *signal, const char *type_data, void *signal_data) { /* make C compiler happy */ + (void) pointer; (void) data; (void) signal; (void) type_data; @@ -619,16 +638,26 @@ irc_bar_item_update_channel () void irc_bar_item_init () { - weechat_bar_item_new ("buffer_plugin", &irc_bar_item_buffer_plugin, NULL); - weechat_bar_item_new ("buffer_name", &irc_bar_item_buffer_name, NULL); - weechat_bar_item_new ("buffer_short_name", &irc_bar_item_buffer_short_name, NULL); - weechat_bar_item_new ("buffer_modes", &irc_bar_item_buffer_modes, NULL); - weechat_bar_item_new ("irc_channel", &irc_bar_item_channel, NULL); - weechat_bar_item_new ("lag", &irc_bar_item_lag, NULL); - weechat_bar_item_new ("input_prompt", &irc_bar_item_input_prompt, NULL); - weechat_bar_item_new ("irc_nick_modes", &irc_bar_item_nick_modes, NULL); + weechat_bar_item_new ("buffer_plugin", + &irc_bar_item_buffer_plugin, NULL, NULL); + weechat_bar_item_new ("buffer_name", + &irc_bar_item_buffer_name, NULL, NULL); + weechat_bar_item_new ("buffer_short_name", + &irc_bar_item_buffer_short_name, NULL, NULL); + weechat_bar_item_new ("buffer_modes", + &irc_bar_item_buffer_modes, NULL, NULL); + weechat_bar_item_new ("irc_channel", + &irc_bar_item_channel, NULL, NULL); + weechat_bar_item_new ("lag", + &irc_bar_item_lag, NULL, NULL); + weechat_bar_item_new ("input_prompt", + &irc_bar_item_input_prompt, NULL, NULL); + weechat_bar_item_new ("irc_nick_modes", + &irc_bar_item_nick_modes, NULL, NULL); + weechat_hook_focus ("buffer_nicklist", - &irc_bar_item_focus_buffer_nicklist, NULL); + &irc_bar_item_focus_buffer_nicklist, NULL, NULL); + weechat_hook_signal ("buffer_switch", - &irc_bar_item_buffer_switch, NULL); + &irc_bar_item_buffer_switch, NULL, NULL); } |