1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

api: send file descriptor as integer instead of string to the callback of hook_fd

This commit is contained in:
Sébastien Helleu
2017-08-13 09:29:39 +02:00
parent 2b7ea69d00
commit 5392e3078f
13 changed files with 65 additions and 39 deletions
+3 -5
View File
@@ -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;