diff options
author | David Brownell <david-b@pacbell.net> | 2008-05-01 07:34:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-01 11:03:59 -0400 |
commit | 34990cf702bdf2b4964e0629dab4af7669f8b2c5 (patch) | |
tree | 33ec40ee97be1a9a6b3565dcf49d1dcffff191f9 /include/linux/string.h | |
parent | 7dffa3c673fbcf835cd7be80bb4aec8ad3f51168 (diff) |
Add a new sysfs_streq() string comparison function
Add a new sysfs_streq() string comparison function, which ignores
the trailing newlines found in sysfs inputs. By example:
sysfs_streq("a", "b") ==> false
sysfs_streq("a", "a") ==> true
sysfs_streq("a", "a\n") ==> true
sysfs_streq("a\n", "a") ==> true
This is intended to simplify parsing of sysfs inputs, letting them
avoid the need to manually strip off newlines from inputs.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/string.h')
-rw-r--r-- | include/linux/string.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/string.h b/include/linux/string.h index c5d3fcad7b57..efdc44593b52 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -109,5 +109,7 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp); | |||
109 | extern char **argv_split(gfp_t gfp, const char *str, int *argcp); | 109 | extern char **argv_split(gfp_t gfp, const char *str, int *argcp); |
110 | extern void argv_free(char **argv); | 110 | extern void argv_free(char **argv); |
111 | 111 | ||
112 | extern bool sysfs_streq(const char *s1, const char *s2); | ||
113 | |||
112 | #endif | 114 | #endif |
113 | #endif /* _LINUX_STRING_H_ */ | 115 | #endif /* _LINUX_STRING_H_ */ |