From a1838c5522e4c386245f17823d247dc76ad91d71 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 7 Jan 2025 18:50:11 +0100 Subject: [PATCH] Fix has_prefix() comparisons with 0 has_prefix() returns a bool, unlike strncmp() which returns an int. Fixes: 0c60d1581f7b ("Use has_prefix() instead of strncmp() throughout") Closes: https://github.com/swaywm/sway/issues/8527 --- sway/commands/bind.c | 2 +- sway/commands/mark.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/commands/bind.c b/sway/commands/bind.c index 0d9347007..32d4f8916 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -398,7 +398,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, list_t *split = split_string(argv[0], "+"); for (int i = 0; i < split->length; ++i) { // Check for group - if (has_prefix(split->items[i], "Group") == 0) { + if (has_prefix(split->items[i], "Group")) { if (binding->group != XKB_LAYOUT_INVALID) { free_sway_binding(binding); list_free_items_and_destroy(split); diff --git a/sway/commands/mark.c b/sway/commands/mark.c index 81bf0e38b..77c8d2394 100644 --- a/sway/commands/mark.c +++ b/sway/commands/mark.c @@ -23,7 +23,7 @@ struct cmd_results *cmd_mark(int argc, char **argv) { } bool add = false, toggle = false; - while (argc > 0 && has_prefix(*argv, "--") == 0) { + while (argc > 0 && has_prefix(*argv, "--")) { if (strcmp(*argv, "--add") == 0) { add = true; } else if (strcmp(*argv, "--replace") == 0) {