Skip to content

Commit

Permalink
Switch strcmp to g_str_equal()
Browse files Browse the repository at this point in the history
The latter is less errorprone for equality comparisons.
  • Loading branch information
whot committed Sep 28, 2023
1 parent 57f6303 commit 73288ee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/test-tablet-svg-validity.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class_found (gchar **classes, gchar *value)
{
gchar **ptr = classes;
while (*ptr) {
if (strcmp (*ptr++, value) == 0)
if (g_str_equal (*ptr++, value))
return TRUE;
}

Expand Down Expand Up @@ -365,7 +365,7 @@ static void setup_tests(WacomDevice *device)
const char *name;

name = libwacom_get_name(device);
if (strcmp(name, "Generic") == 0)
if (g_str_equal(name, "Generic"))
return;

add_test(device, test_filename);
Expand Down
2 changes: 1 addition & 1 deletion test/test-tablet-validity.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static void setup_tests(WacomDevice *device)
WacomClass cls;

name = libwacom_get_name(device);
if (strcmp(name, "Generic") == 0)
if (g_str_equal(name, "Generic"))
return;

add_test(device, test_class);
Expand Down
3 changes: 2 additions & 1 deletion tools/list-compatible-styli.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <assert.h>
#include <libgen.h>
#include <unistd.h>
#include <glib.h>
#include "libwacom.h"

static void
Expand Down Expand Up @@ -72,7 +73,7 @@ int main(int argc, char **argv)
if (argc > 1) {
printf("Usage: %s [--help] - list compatible styli\n",
basename(argv[0]));
return !!(strcmp(argv[1], "--help"));
return g_str_equal(argv[1], "--help");
}

db = libwacom_database_new_for_path(DATABASEPATH);
Expand Down

0 comments on commit 73288ee

Please sign in to comment.