summaryrefslogtreecommitdiff
path: root/tools/include/linux/string.h
diff options
context:
space:
mode:
authorMaarten Lankhorst <dev@lankhorst.se>2025-12-15 14:53:27 +0300
committerMaarten Lankhorst <dev@lankhorst.se>2025-12-15 14:53:27 +0300
commit84318277d6334c6981ab326d4acc87c6a6ddc9b8 (patch)
tree12f53a532096223decf6ed1e2a582fb03bc947a1 /tools/include/linux/string.h
parent630efee9493cf64ff7b9a1652978807fef385fdd (diff)
parent8f0b4cce4481fb22653697cced8d0d04027cb1e8 (diff)
downloadlinux-84318277d6334c6981ab326d4acc87c6a6ddc9b8.tar.xz
Merge remote-tracking branch 'drm/drm-fixes' into drm-misc-fixes
Pull in rc1 to include all changes since the merge window closed, and grab all fixes and changes from drm/drm-next. Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
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 *);