stringop: fix has_prefix() arg order in config parsing

has_prefix() expects the prefix to be the 2nd argument, not the first.

The config parsing was broken when using `--input-device=`.

Introduced by: 0c60d1581f "Use has_prefix()
instead of strncmp() throughout"
This commit is contained in:
Paul Riou 2025-03-20 20:01:36 +00:00 committed by Simon Ser
parent d148560f50
commit 4b185a0fe0
3 changed files with 3 additions and 3 deletions

View file

@ -367,7 +367,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
}
} else if (strcmp("--exclude-titlebar", argv[0]) == 0) {
exclude_titlebar = true;
} else if (has_prefix("--input-device=", argv[0])) {
} else if (has_prefix(argv[0], "--input-device=")) {
free(binding->input);
binding->input = strdup(argv[0] + strlen("--input-device="));
strip_quotes(binding->input);

View file

@ -121,7 +121,7 @@ static struct cmd_results *cmd_bind_or_unbind_gesture(int argc, char **argv, boo
binding->flags |= BINDING_EXACT;
} else if (strcmp("--no-warn", argv[0]) == 0) {
warn = false;
} else if (has_prefix("--input-device=", argv[0])) {
} else if (has_prefix(argv[0], "--input-device=")) {
free(binding->input);
binding->input = strdup(argv[0] + strlen("--input-device="));
} else {

View file

@ -46,7 +46,7 @@ void ipc_send_workspace_command(struct swaybar *bar, const char *ws) {
char *parse_font(const char *font) {
char *new_font = NULL;
if (has_prefix("pango:", font)) {
if (has_prefix(font, "pango:")) {
font += strlen("pango:");
}
new_font = strdup(font);