Fix has_prefix() comparisons with 0

has_prefix() returns a bool, unlike strncmp() which returns an int.

Fixes: 0c60d1581f ("Use has_prefix() instead of strncmp() throughout")
Closes: https://github.com/swaywm/sway/issues/8527
This commit is contained in:
Simon Ser 2025-01-07 18:50:11 +01:00 committed by Kenny Levinsen
parent 0c60d1581f
commit a1838c5522
2 changed files with 2 additions and 2 deletions

View file

@ -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);

View file

@ -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) {