summaryrefslogtreecommitdiffstats
path: root/lib/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/string.c b/lib/string.c
index bb3d4b6993c4..13d1e84ddb80 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -849,3 +849,20 @@ void *memchr_inv(const void *start, int c, size_t bytes)
849 return check_bytes8(start, value, bytes % 8); 849 return check_bytes8(start, value, bytes % 8);
850} 850}
851EXPORT_SYMBOL(memchr_inv); 851EXPORT_SYMBOL(memchr_inv);
852
853/**
854 * strreplace - Replace all occurrences of character in string.
855 * @s: The string to operate on.
856 * @old: The character being replaced.
857 * @new: The character @old is replaced with.
858 *
859 * Returns pointer to the nul byte at the end of @s.
860 */
861char *strreplace(char *s, char old, char new)
862{
863 for (; *s; ++s)
864 if (*s == old)
865 *s = new;
866 return s;
867}
868EXPORT_SYMBOL(strreplace);