summaryrefslogtreecommitdiff
path: root/tools/include/linux/string.h
diff options
context:
space:
mode:
authorThomas Hellström <thomas.hellstrom@linux.intel.com>2025-12-19 13:51:22 +0300
committerThomas Hellström <thomas.hellstrom@linux.intel.com>2025-12-19 13:51:22 +0300
commit5add3c3c280a35f7e258e9cef7607db5a2e56fdc (patch)
tree22eca9a4a1003a64933980bf76da2fbe8a74f759 /tools/include/linux/string.h
parentc7b83a916d62c4d4447d7edf0bc5e06dc2afbdf8 (diff)
parent8f0b4cce4481fb22653697cced8d0d04027cb1e8 (diff)
downloadlinux-5add3c3c280a35f7e258e9cef7607db5a2e56fdc.tar.xz
Merge drm/drm-next into drm-xe-next
Backmerging to bring in 6.19-rc1. An important upstream bugfix and to help unblock PTL CI. Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Diffstat (limited to 'tools/include/linux/string.h')
-rw-r--r--tools/include/linux/string.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h
index 8499f509f03e..51ad3cf4fa82 100644
--- a/tools/include/linux/string.h
+++ b/tools/include/linux/string.h
@@ -44,6 +44,20 @@ static inline bool strstarts(const char *str, const char *prefix)
return strncmp(str, prefix, strlen(prefix)) == 0;
}
+/*
+ * Checks if a string ends with another.
+ */
+static inline bool str_ends_with(const char *str, const char *substr)
+{
+ size_t len = strlen(str);
+ size_t sublen = strlen(substr);
+
+ if (sublen > len)
+ return false;
+
+ return !strcmp(str + len - sublen, substr);
+}
+
extern char * __must_check skip_spaces(const char *);
extern char *strim(char *);