From: Jérémie Galarneau Date: Thu, 18 Feb 2021 22:04:46 +0000 (-0500) Subject: Clean-up: lttng: replace manual string comparison code by strcasecmp X-Git-Tag: v2.13.0-rc1~322 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f41294ed836a1eaa49f125aea9d95e4e35ad3844;p=lttng-tools.git Clean-up: lttng: replace manual string comparison code by strcasecmp Signed-off-by: Jérémie Galarneau Change-Id: I7ce19e29751301513ccab9fdca53689207b71ef1 --- diff --git a/src/bin/lttng/loglevel.c b/src/bin/lttng/loglevel.c index e59c24813..9f65df006 100644 --- a/src/bin/lttng/loglevel.c +++ b/src/bin/lttng/loglevel.c @@ -7,6 +7,7 @@ #include "loglevel.h" #include +#include #include #include @@ -119,25 +120,7 @@ const struct loglevel_name_value loglevel_python_values[] = { static bool string_equal_insensitive(const char *a, const char *b) { - bool result; - - assert(a && b); - - while (*a && *b) { - if (toupper(*a) != toupper(*b)) { - result = false; - goto end; - } - - a++; - b++; - } - - /* If a and b don't have the same length, consider them unequal. */ - result = *a == *b; - -end: - return result; + return strcasecmp(a, b) == 0; } static