diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-08-13 09:29:39 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-08-13 09:29:39 +0200 |
commit | 5392e3078f454103c0606bb990ad8acffd7a4ae1 (patch) | |
tree | e82341d5a4037d1886874703bdb32de831d67683 /src | |
parent | 2b7ea69d00526c0f94c20bf670da86344437e0d5 (diff) | |
download | weechat-5392e3078f454103c0606bb990ad8acffd7a4ae1.zip |
api: send file descriptor as integer instead of string to the callback of hook_fd
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 8 | ||||
-rw-r--r-- | src/plugins/javascript/weechat-js-api.cpp | 8 | ||||
-rw-r--r-- | src/plugins/lua/weechat-lua-api.c | 8 | ||||
-rw-r--r-- | src/plugins/perl/weechat-perl-api.c | 8 | ||||
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 8 | ||||
-rw-r--r-- | src/plugins/ruby/weechat-ruby-api.c | 8 | ||||
-rw-r--r-- | src/plugins/tcl/weechat-tcl-api.c | 8 |
7 files changed, 21 insertions, 35 deletions
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 6aefa3bd2..3f1182856 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -2206,7 +2206,7 @@ weechat_guile_api_hook_fd_cb (const void *pointer, void *data, int fd) { struct t_plugin_script *script; void *func_argv[2]; - char str_fd[32], empty_arg[1] = { '\0' }; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -2215,15 +2215,13 @@ weechat_guile_api_hook_fd_cb (const void *pointer, void *data, int fd) if (ptr_function && ptr_function[0]) { - snprintf (str_fd, sizeof (str_fd), "%d", fd); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; - func_argv[1] = str_fd; + func_argv[1] = &fd; rc = (int *) weechat_guile_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ss", func_argv); + "si", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp index ee3cfdbbf..c41c613f9 100644 --- a/src/plugins/javascript/weechat-js-api.cpp +++ b/src/plugins/javascript/weechat-js-api.cpp @@ -2121,7 +2121,7 @@ weechat_js_api_hook_fd_cb (const void *pointer, void *data, int fd) { struct t_plugin_script *script; void *func_argv[2]; - char str_fd[32], empty_arg[1] = { '\0' }; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -2130,15 +2130,13 @@ weechat_js_api_hook_fd_cb (const void *pointer, void *data, int fd) if (ptr_function && ptr_function[0]) { - snprintf (str_fd, sizeof (str_fd), "%d", fd); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; - func_argv[1] = str_fd; + func_argv[1] = &fd; rc = (int *)weechat_js_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ss", func_argv); + "si", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index a8d07e5bd..9148bfb2c 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -2316,7 +2316,7 @@ weechat_lua_api_hook_fd_cb (const void *pointer, void *data, int fd) { struct t_plugin_script *script; void *func_argv[2]; - char str_fd[32], empty_arg[1] = { '\0' }; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -2325,15 +2325,13 @@ weechat_lua_api_hook_fd_cb (const void *pointer, void *data, int fd) if (ptr_function && ptr_function[0]) { - snprintf (str_fd, sizeof (str_fd), "%d", fd); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; - func_argv[1] = str_fd; + func_argv[1] = &fd; rc = (int *) weechat_lua_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ss", func_argv); + "si", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index 084400f71..982aeaba2 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -2246,7 +2246,7 @@ weechat_perl_api_hook_fd_cb (const void *pointer, void *data, int fd) { struct t_plugin_script *script; void *func_argv[2]; - char str_fd[32], empty_arg[1] = { '\0' }; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -2255,15 +2255,13 @@ weechat_perl_api_hook_fd_cb (const void *pointer, void *data, int fd) if (ptr_function && ptr_function[0]) { - snprintf (str_fd, sizeof (str_fd), "%d", fd); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; - func_argv[1] = str_fd; + func_argv[1] = &fd; rc = (int *) weechat_perl_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ss", func_argv); + "si", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index cddaf1691..f3384bd4e 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -2247,7 +2247,7 @@ weechat_python_api_hook_fd_cb (const void *pointer, void *data, int fd) { struct t_plugin_script *script; void *func_argv[2]; - char str_fd[32], empty_arg[1] = { '\0' }; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -2256,15 +2256,13 @@ weechat_python_api_hook_fd_cb (const void *pointer, void *data, int fd) if (ptr_function && ptr_function[0]) { - snprintf (str_fd, sizeof (str_fd), "%d", fd); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; - func_argv[1] = str_fd; + func_argv[1] = &fd; rc = (int *) weechat_python_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ss", func_argv); + "si", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 8a819e622..488ec9193 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -2735,7 +2735,7 @@ weechat_ruby_api_hook_fd_cb (const void *pointer, void *data, int fd) { struct t_plugin_script *script; void *func_argv[2]; - char str_fd[32], empty_arg[1] = { '\0' }; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -2744,15 +2744,13 @@ weechat_ruby_api_hook_fd_cb (const void *pointer, void *data, int fd) if (ptr_function && ptr_function[0]) { - snprintf (str_fd, sizeof (str_fd), "%d", fd); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; - func_argv[1] = str_fd; + func_argv[1] = &fd; rc = (int *) weechat_ruby_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ss", func_argv); + "si", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index dab21c51e..90a21566d 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -2497,7 +2497,7 @@ weechat_tcl_api_hook_fd_cb (const void *pointer, void *data, int fd) { struct t_plugin_script *script; void *func_argv[2]; - char str_fd[32], empty_arg[1] = { '\0' }; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -2506,15 +2506,13 @@ weechat_tcl_api_hook_fd_cb (const void *pointer, void *data, int fd) if (ptr_function && ptr_function[0]) { - snprintf (str_fd, sizeof (str_fd), "%d", fd); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; - func_argv[1] = str_fd; + func_argv[1] = &fd; rc = (int *) weechat_tcl_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ss", func_argv); + "si", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; |