From 1b18ba3a033f3e102685be1088776c37b8572a26 Mon Sep 17 00:00:00 2001 From: Bjoern Walk Date: Tue, 15 Oct 2024 16:43:55 +0200 Subject: [PATCH] hyptop: Switch to util_str_toupper() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of implementing our own version, use the available library function util_str_toupper() from libutil. Reviewed-by: Mete Durlu Reviewed-by: Jan Höppner Reviewed-by: Steffen Eiden Signed-off-by: Bjoern Walk Signed-off-by: Jan Höppner --- hyptop/helper.c | 11 ----------- hyptop/opts.c | 3 ++- hyptop/table.c | 6 ++++-- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/hyptop/helper.c b/hyptop/helper.c index 0495ac1b..162caa1b 100644 --- a/hyptop/helper.c +++ b/hyptop/helper.c @@ -354,17 +354,6 @@ out: ht_reverse_off(); } -/* - * Convert string to uppercase - */ -void ht_str_to_upper(char *str) -{ - while (*str) { - *str = toupper(*str); - str++; - } -} - /* * Convert ext TOD to microseconds */ diff --git a/hyptop/opts.c b/hyptop/opts.c index 13953a0c..68596efa 100644 --- a/hyptop/opts.c +++ b/hyptop/opts.c @@ -12,6 +12,7 @@ #include #include +#include "lib/util_libc.h" #include "lib/zt_common.h" #include "getopt.h" @@ -404,7 +405,7 @@ static void l_verify_systems(struct hyptop_win *win) if (sd_sys_get(sd_sys_root_get(), win->opts.sys.vec[i])) continue; sys_name = ht_strdup(win->opts.sys.vec[i]); - ht_str_to_upper(win->opts.sys.vec[i]); + util_str_toupper(win->opts.sys.vec[i]); if (sd_sys_get(sd_sys_root_get(), win->opts.sys.vec[i])) { ht_free(sys_name); continue; diff --git a/hyptop/table.c b/hyptop/table.c index a22754c7..13051b49 100644 --- a/hyptop/table.c +++ b/hyptop/table.c @@ -16,6 +16,8 @@ #include #include +#include "lib/util_libc.h" + #include "helper.h" #include "hyptop.h" #include "table.h" @@ -196,8 +198,8 @@ static void l_col_headline_init(struct table *t, struct table_col *col) col->p->head_char[0] = col->hotkey; strcpy(col->p->head_last, ++ptr); if (!t->attr_sorted_table) { - ht_str_to_upper(col->p->head_first); - ht_str_to_upper(col->p->head_last); + util_str_toupper(col->p->head_first); + util_str_toupper(col->p->head_last); col->p->head_char[0] = toupper(col->p->head_char[0]); } }