summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2025-01-07 13:21:37 +0100
committerKenny Levinsen <kl@kl.wtf>2025-01-07 16:35:31 +0100
commitc55dff95bcf2875ff26a0505c6eda44947ed927d (patch)
tree35f3b8af610894513e2ea0ae7321b1c631708bc9
parent801bc76ce3ab2f620e30d1d0ad979caa5b03a164 (diff)
stringop: move over has_prefix()
-rw-r--r--common/stringop.c4
-rw-r--r--include/stringop.h2
-rw-r--r--sway/input/seat.c4
3 files changed, 6 insertions, 4 deletions
diff --git a/common/stringop.c b/common/stringop.c
index 16d04917..dcbd1656 100644
--- a/common/stringop.c
+++ b/common/stringop.c
@@ -360,3 +360,7 @@ char *format_str(const char *fmt, ...) {
va_end(args);
return str;
}
+
+bool has_prefix(const char *str, const char *prefix) {
+ return strncmp(str, prefix, strlen(prefix)) == 0;
+}
diff --git a/include/stringop.h b/include/stringop.h
index 19a50f23..ffc355cf 100644
--- a/include/stringop.h
+++ b/include/stringop.h
@@ -40,4 +40,6 @@ bool expand_path(char **path);
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);
+bool has_prefix(const char *str, const char *prefix);
+
#endif
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 0dd26290..1b63f625 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -647,10 +647,6 @@ static void seat_reset_input_config(struct sway_seat *seat,
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
* exactly one built-in output.