diff options
| author | Simon Ser <contact@emersion.fr> | 2025-01-07 18:50:11 +0100 |
|---|---|---|
| committer | Kenny Levinsen <kl@kl.wtf> | 2025-01-07 18:56:02 +0100 |
| commit | a1838c5522e4c386245f17823d247dc76ad91d71 (patch) | |
| tree | 8f9ea3859afb508309148d406492fa66be598eac | |
| parent | 0c60d1581f7b12ae472c786b7dfe27a1c6ec9a47 (diff) | |
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
| -rw-r--r-- | sway/commands/bind.c | 2 | ||||
| -rw-r--r-- | 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 0d934700..32d4f891 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 81bf0e38..77c8d239 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) { |
