summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/scripts/guile/weechat-guile-api.c8
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c8
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c8
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c12
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c8
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c8
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl.c2
7 files changed, 23 insertions, 31 deletions
diff --git a/src/plugins/scripts/guile/weechat-guile-api.c b/src/plugins/scripts/guile/weechat-guile-api.c
index 8afb11b21..4e5084567 100644
--- a/src/plugins/scripts/guile/weechat-guile-api.c
+++ b/src/plugins/scripts/guile/weechat-guile-api.c
@@ -2361,25 +2361,23 @@ weechat_guile_api_hook_process_cb (void *data,
{
struct t_script_callback *script_callback;
void *func_argv[5];
- char str_rc[32], empty_arg[1] = { '\0' };
+ char empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
- func_argv[2] = str_rc;
+ func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", func_argv);
+ "ssiss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index ca787456b..29668aa11 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -2605,25 +2605,23 @@ weechat_lua_api_hook_process_cb (void *data,
{
struct t_script_callback *script_callback;
void *func_argv[5];
- char str_rc[32], empty_arg[1] = { '\0' };
+ char empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
- func_argv[2] = str_rc;
+ func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", func_argv);
+ "ssiss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 4d3a4dacb..c2f7a8162 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -2447,25 +2447,23 @@ weechat_perl_api_hook_process_cb (void *data,
{
struct t_script_callback *script_callback;
void *func_argv[5];
- char str_rc[32], empty_arg[1] = { '\0' };
+ char empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
- func_argv[2] = str_rc;
+ func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", func_argv);
+ "ssiss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index ca9984299..bc1076fb0 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -2547,25 +2547,23 @@ weechat_python_api_hook_process_cb (void *data,
{
struct t_script_callback *script_callback;
void *func_argv[5];
- char str_rc[32], empty_arg[1] = { '\0' };
+ char empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
- func_argv[2] = str_rc;
+ func_argv[2] = PyLong_FromLong((long)return_code);
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", func_argv);
+ "ssOss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2574,6 +2572,10 @@ weechat_python_api_hook_process_cb (void *data,
ret = *rc;
free (rc);
}
+ if (func_argv[2])
+ {
+ Py_XDECREF((PyObject *)func_argv[2]);
+ }
return ret;
}
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 32f85a5f2..1bc01b1fd 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -2920,25 +2920,23 @@ weechat_ruby_api_hook_process_cb (void *data,
{
struct t_script_callback *script_callback;
void *func_argv[5];
- char str_rc[32], empty_arg[1] = { '\0' };
+ char empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
- func_argv[2] = str_rc;
+ func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", func_argv);
+ "ssiss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 682437932..c282242e4 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -2869,25 +2869,23 @@ weechat_tcl_api_hook_process_cb (void *data,
{
struct t_script_callback *script_callback;
void *func_argv[5];
- char str_rc[32], empty_arg[1] = { '\0' };
+ char empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
- func_argv[2] = str_rc;
+ func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", func_argv);
+ "ssiss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
diff --git a/src/plugins/scripts/tcl/weechat-tcl.c b/src/plugins/scripts/tcl/weechat-tcl.c
index 429ca119a..dbffefd2c 100644
--- a/src/plugins/scripts/tcl/weechat-tcl.c
+++ b/src/plugins/scripts/tcl/weechat-tcl.c
@@ -208,7 +208,7 @@ weechat_tcl_exec (struct t_plugin_script *script,
break;
case 'i': /* integer */
Tcl_ListObjAppendElement (interp, cmdlist,
- Tcl_NewStringObj (argv[i], -1));
+ Tcl_NewIntObj (*((int *)argv[i])));
break;
case 'h': /* hash */
Tcl_ListObjAppendElement (interp, cmdlist,