From b56451e5a4750f4761c4a50cc8abd35e245e3e36 Mon Sep 17 00:00:00 2001 From: Jan Polensky Date: Thu, 28 Aug 2025 11:53:23 +0200 Subject: [PATCH] cpumf/lspai.c: Use util_str_toupper() instead of str2uc() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the custom str2uc() implementation with util_str_toupper() to reduce code duplication and improve maintainability. Acked-by: Thomas Richter Reviewed-by: Thomas Richter Signed-off-by: Jan Polensky Signed-off-by: Jan Höppner --- cpumf/lspai.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/cpumf/lspai.c b/cpumf/lspai.c index 4fad691f..20a57fd4 100644 --- a/cpumf/lspai.c +++ b/cpumf/lspai.c @@ -6,7 +6,6 @@ /* List available Processor Assist Instrumentation (PAI) counters. */ -#include #include #include #include @@ -234,16 +233,6 @@ static int pai_ctrcmp(const void *p1, const void *p2) return l->nr > r->nr ? 1 : -1; } -/* Convert string to upper case. */ -static char *str2uc(const char *s) -{ - char *uc = util_strdup(s), *old_uc = uc; - - for (; *uc; ++uc) - *uc = toupper(*uc); - return old_uc; -} - /* Return true if the counter is in the ctrlist. An empty ctrlist * disables all counters. */ @@ -397,7 +386,8 @@ static void make_painode(enum pai_types t) node->type = t; node->sysfs_name = pai_type_sysfs(t); node->name = pai_type_name(t); - node->name_uc = str2uc(node->name); + node->name_uc = util_strdup(node->name); + util_str_toupper(node->name_uc); node->filter_name = pai_type_filter(t); node->base = pai_type_base(t);