diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2014-05-10 08:26:56 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2014-05-10 08:26:56 +0200 |
commit | cdab55aa0552356173815cfc79a7b9ddc0a435ed (patch) | |
tree | 9b833e42e2552477b60520259a12c4ba06fa42b3 /src/plugins | |
parent | 6d205222aa80d623b8f0f13514bd7046eea42f00 (diff) | |
download | weechat-cdab55aa0552356173815cfc79a7b9ddc0a435ed.zip |
api: change type of arguments displayed/highlight in hook_print callback from string to integer (in scripts)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 10 | ||||
-rw-r--r-- | src/plugins/lua/weechat-lua-api.c | 10 | ||||
-rw-r--r-- | src/plugins/perl/weechat-perl-api.c | 10 | ||||
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 14 | ||||
-rw-r--r-- | src/plugins/ruby/weechat-ruby-api.c | 10 | ||||
-rw-r--r-- | src/plugins/tcl/weechat-tcl-api.c | 10 |
6 files changed, 24 insertions, 40 deletions
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 1a1220e0a..fa0536697 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -2300,15 +2300,15 @@ weechat_guile_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, func_argv[3] = weechat_string_build_with_split_string (tags, ","); if (!func_argv[3]) func_argv[3] = strdup (""); - func_argv[4] = (displayed) ? strdup ("1") : strdup ("0"); - func_argv[5] = (highlight) ? strdup ("1") : strdup ("0"); + func_argv[4] = &displayed; + func_argv[5] = &highlight; func_argv[6] = (prefix) ? (char *)prefix : empty_arg; func_argv[7] = (message) ? (char *)message : empty_arg; rc = (int *) weechat_guile_exec (script_callback->script, WEECHAT_SCRIPT_EXEC_INT, script_callback->function, - "ssssssss", func_argv); + "ssssiiss", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; @@ -2321,10 +2321,6 @@ weechat_guile_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, free (func_argv[1]); if (func_argv[3]) free (func_argv[3]); - if (func_argv[4]) - free (func_argv[4]); - if (func_argv[5]) - free (func_argv[5]); return ret; } diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index d7f841c21..7e9d4b02c 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -2496,15 +2496,15 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, func_argv[3] = weechat_string_build_with_split_string (tags, ","); if (!func_argv[3]) func_argv[3] = strdup (""); - func_argv[4] = (displayed) ? strdup ("1") : strdup ("0"); - func_argv[5] = (highlight) ? strdup ("1") : strdup ("0"); + func_argv[4] = &displayed; + func_argv[5] = &highlight; func_argv[6] = (prefix) ? (char *)prefix : empty_arg; func_argv[7] = (message) ? (char *)message : empty_arg; rc = (int *) weechat_lua_exec (script_callback->script, WEECHAT_SCRIPT_EXEC_INT, script_callback->function, - "ssssssss", func_argv); + "ssssiiss", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; @@ -2517,10 +2517,6 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, free (func_argv[1]); if (func_argv[3]) free (func_argv[3]); - if (func_argv[4]) - free (func_argv[4]); - if (func_argv[5]) - free (func_argv[5]); return ret; } diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index 6026cfd90..b6af4654d 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -2332,15 +2332,15 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, func_argv[3] = weechat_string_build_with_split_string (tags, ","); if (!func_argv[3]) func_argv[3] = strdup (""); - func_argv[4] = (displayed) ? strdup ("1") : strdup ("0"); - func_argv[5] = (highlight) ? strdup ("1") : strdup ("0"); + func_argv[4] = &displayed; + func_argv[5] = &highlight; func_argv[6] = (prefix) ? (char *)prefix : empty_arg; func_argv[7] = (message) ? (char *)message : empty_arg; rc = (int *) weechat_perl_exec (script_callback->script, WEECHAT_SCRIPT_EXEC_INT, script_callback->function, - "ssssssss", func_argv); + "ssssiiss", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; @@ -2353,10 +2353,6 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, free (func_argv[1]); if (func_argv[3]) free (func_argv[3]); - if (func_argv[4]) - free (func_argv[4]); - if (func_argv[5]) - free (func_argv[5]); return ret; } diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index ee0dfa4be..c79196ad5 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -2438,15 +2438,15 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, func_argv[3] = weechat_string_build_with_split_string (tags, ","); if (!func_argv[3]) func_argv[3] = strdup (""); - func_argv[4] = (displayed) ? strdup ("1") : strdup ("0"); - func_argv[5] = (highlight) ? strdup ("1") : strdup ("0"); + func_argv[4] = PyLong_FromLong((long)displayed); + func_argv[5] = PyLong_FromLong((long)highlight); func_argv[6] = (prefix) ? (char *)prefix : empty_arg; func_argv[7] = (message) ? (char *)message : empty_arg; rc = (int *) weechat_python_exec (script_callback->script, WEECHAT_SCRIPT_EXEC_INT, script_callback->function, - "ssssssss", func_argv); + "ssssOOss", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; @@ -2460,9 +2460,13 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, if (func_argv[3]) free (func_argv[3]); if (func_argv[4]) - free (func_argv[4]); + { + Py_XDECREF((PyObject *)func_argv[4]); + } if (func_argv[5]) - free (func_argv[5]); + { + Py_XDECREF((PyObject *)func_argv[5]); + } return ret; } diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 6f4f332a7..752a17861 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -2848,15 +2848,15 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, func_argv[3] = weechat_string_build_with_split_string (tags, ","); if (!func_argv[3]) func_argv[3] = strdup (""); - func_argv[4] = (displayed) ? strdup ("1") : strdup ("0"); - func_argv[5] = (highlight) ? strdup ("1") : strdup ("0"); + func_argv[4] = &displayed; + func_argv[5] = &highlight; func_argv[6] = (prefix) ? (char *)prefix : empty_arg; func_argv[7] = (message) ? (char *)message : empty_arg; rc = (int *) weechat_ruby_exec (script_callback->script, WEECHAT_SCRIPT_EXEC_INT, script_callback->function, - "ssssssss", func_argv); + "ssssiiss", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; @@ -2869,10 +2869,6 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, free (func_argv[1]); if (func_argv[3]) free (func_argv[3]); - if (func_argv[4]) - free (func_argv[4]); - if (func_argv[5]) - free (func_argv[5]); return ret; } diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index cf79da7f8..7ba8689e3 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -2764,15 +2764,15 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, func_argv[3] = weechat_string_build_with_split_string (tags, ","); if (!func_argv[3]) func_argv[3] = strdup (""); - func_argv[4] = (displayed) ? strdup ("1") : strdup ("0"); - func_argv[5] = (highlight) ? strdup ("1") : strdup ("0"); + func_argv[4] = &displayed; + func_argv[5] = &highlight; func_argv[6] = (prefix) ? (char *)prefix : empty_arg; func_argv[7] = (message) ? (char *)message : empty_arg; rc = (int *) weechat_tcl_exec (script_callback->script, WEECHAT_SCRIPT_EXEC_INT, script_callback->function, - "ssssssss", func_argv); + "ssssiiss", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; @@ -2785,10 +2785,6 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, free (func_argv[1]); if (func_argv[3]) free (func_argv[3]); - if (func_argv[4]) - free (func_argv[4]); - if (func_argv[5]) - free (func_argv[5]); return ret; } |