OSDN Git Service

Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[uclinux-h8/linux.git] / lib / string.c
index bb3d4b6..13d1e84 100644 (file)
@@ -849,3 +849,20 @@ void *memchr_inv(const void *start, int c, size_t bytes)
        return check_bytes8(start, value, bytes % 8);
 }
 EXPORT_SYMBOL(memchr_inv);
+
+/**
+ * strreplace - Replace all occurrences of character in string.
+ * @s: The string to operate on.
+ * @old: The character being replaced.
+ * @new: The character @old is replaced with.
+ *
+ * Returns pointer to the nul byte at the end of @s.
+ */
+char *strreplace(char *s, char old, char new)
+{
+       for (; *s; ++s)
+               if (*s == old)
+                       *s = new;
+       return s;
+}
+EXPORT_SYMBOL(strreplace);