stringop: move over has_prefix()

This commit is contained in:
Simon Ser 2025-01-07 13:21:37 +01:00 committed by Kenny Levinsen
parent 801bc76ce3
commit c55dff95bc
3 changed files with 6 additions and 4 deletions

View file

@ -360,3 +360,7 @@ char *format_str(const char *fmt, ...) {
va_end(args); va_end(args);
return str; return str;
} }
bool has_prefix(const char *str, const char *prefix) {
return strncmp(str, prefix, strlen(prefix)) == 0;
}

View file

@ -40,4 +40,6 @@ bool expand_path(char **path);
char *vformat_str(const char *fmt, va_list args) _SWAY_ATTRIB_PRINTF(1, 0); char *vformat_str(const char *fmt, va_list args) _SWAY_ATTRIB_PRINTF(1, 0);
char *format_str(const char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2); char *format_str(const char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2);
bool has_prefix(const char *str, const char *prefix);
#endif #endif

View file

@ -647,10 +647,6 @@ static void seat_reset_input_config(struct sway_seat *seat,
sway_device->input_device->wlr_device, NULL); sway_device->input_device->wlr_device, NULL);
} }
static bool has_prefix(const char *str, const char *prefix) {
return strncmp(str, prefix, strlen(prefix)) == 0;
}
/** /**
* Get the name of the built-in output, if any. Returns NULL if there isn't * Get the name of the built-in output, if any. Returns NULL if there isn't
* exactly one built-in output. * exactly one built-in output.