]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/string.h
strstarts: helper function for !strncmp(str, prefix, strlen(prefix))
[linux-2.6-omap-h63xx.git] / include / linux / string.h
index 810d80df0a1d1700956e40ededaeefe29883ab46..76ec218bb30f090781ee9b74d27ac290d5c2b32e 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _LINUX_STRING_H_
 #define _LINUX_STRING_H_
 
-/* We don't want strings.h stuff being user by user stuff by accident */
+/* We don't want strings.h stuff being used by user stuff by accident */
 
 #ifndef __KERNEL__
 #include <string.h>
@@ -114,5 +114,14 @@ extern bool sysfs_streq(const char *s1, const char *s2);
 extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
                        const void *from, size_t available);
 
+/**
+ * strstarts - does @str start with @prefix?
+ * @str: string to examine
+ * @prefix: prefix to look for.
+ */
+static inline bool strstarts(const char *str, const char *prefix)
+{
+       return strncmp(str, prefix, strlen(prefix)) == 0;
+}
 #endif
 #endif /* _LINUX_STRING_H_ */