From 054b7ff60015aab99acde2a6e22e38c980fb098b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 20 Jun 2026 10:38:16 +0200 Subject: [PATCH] exec: use util functions to parse integers --- src/plugins/exec/exec-command.c | 8 +++----- src/plugins/exec/exec.c | 5 +---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/plugins/exec/exec-command.c b/src/plugins/exec/exec-command.c index 85c4cbe6f..88ce5538e 100644 --- a/src/plugins/exec/exec-command.c +++ b/src/plugins/exec/exec-command.c @@ -185,8 +185,7 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options, int argc, char **argv, int start_arg, int set_command_index) { - int i, j, end, length, length_total; - char *error; + int i, j, end, length, length_total, timeout; for (i = start_arg; i < argc; i++) { @@ -318,10 +317,9 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options, if (i + 1 >= argc) return 0; i++; - error = NULL; - cmd_options->timeout = strtol (argv[i], &error, 10); - if (!error || error[0]) + if (!weechat_util_parse_int (argv[i], 10, &timeout)) return 0; + cmd_options->timeout = timeout; } else if (weechat_strcmp (argv[i], "-name") == 0) { diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c index 3793f389e..9ba5669b9 100644 --- a/src/plugins/exec/exec.c +++ b/src/plugins/exec/exec.c @@ -85,15 +85,12 @@ struct t_exec_cmd * exec_search_by_id (const char *id) { struct t_exec_cmd* ptr_exec_cmd; - char *error; long number; if (!id) return NULL; - error = NULL; - number = strtol (id, &error, 10); - if (!error || error[0]) + if (!weechat_util_parse_long (id, 10, &number)) number = -1; for (ptr_exec_cmd = exec_cmds; ptr_exec_cmd;