From bed3467efbdb9df28485217ebed11f31c7dc7a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 5 Apr 2026 17:01:45 +0200 Subject: [PATCH] core: use function util_parse_int in function gui_focus_info_hashtable_gui_focus_info_cb --- src/gui/gui-focus.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/gui/gui-focus.c b/src/gui/gui-focus.c index 473ea6bd3..3477d3dc3 100644 --- a/src/gui/gui-focus.c +++ b/src/gui/gui-focus.c @@ -32,6 +32,7 @@ #include "../core/core-hashtable.h" #include "../core/core-hook.h" #include "../core/core-string.h" +#include "../core/core-util.h" #include "../plugins/plugin.h" #include "gui-bar.h" #include "gui-bar-window.h" @@ -280,11 +281,10 @@ gui_focus_info_hashtable_gui_focus_info_cb (const void *pointer, void *data, const char *info_name, struct t_hashtable *hashtable) { - char *error; - const char *ptr_value; - int x, y; struct t_gui_focus_info *focus_info; struct t_hashtable *focus_hashtable, *ret_hashtable; + const char *ptr_value; + int x, y; /* make C compiler happy */ (void) pointer; @@ -298,17 +298,13 @@ gui_focus_info_hashtable_gui_focus_info_cb (const void *pointer, void *data, ptr_value = hashtable_get (hashtable, "x"); if (!ptr_value) return NULL; - error = NULL; - x = (int)strtol (ptr_value, &error, 10); - if (!error || error[0]) + if (!util_parse_int (ptr_value, 10, &x)) return NULL; ptr_value = hashtable_get (hashtable, "y"); if (!ptr_value) return NULL; - error = NULL; - y = (int)strtol (ptr_value, &error, 10); - if (!error || error[0]) + if (!util_parse_int (ptr_value, 10, &y)) return NULL; /* get focus info */