Clean-up: lttng: replace manual string comparison code by strcasecmp
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Feb 2021 22:04:46 +0000 (17:04 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Feb 2021 23:48:45 +0000 (18:48 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I7ce19e29751301513ccab9fdca53689207b71ef1

src/bin/lttng/loglevel.c

index e59c248131b2cc57885ff6be50eb63b4da1467e1..9f65df00664cbfb87fde03d551e5aa24dfbf3c49 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "loglevel.h"
 #include <string.h>
+#include <strings.h>
 #include <ctype.h>
 #include <assert.h>
 
@@ -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
This page took 0.026039 seconds and 4 git commands to generate.