diff options
Diffstat (limited to 'lib/string.c')
-rw-r--r-- | lib/string.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/string.c b/lib/string.c index 9b1f9062a202..992bf30af759 100644 --- a/lib/string.c +++ b/lib/string.c | |||
@@ -107,7 +107,7 @@ EXPORT_SYMBOL(strcpy); | |||
107 | 107 | ||
108 | #ifndef __HAVE_ARCH_STRNCPY | 108 | #ifndef __HAVE_ARCH_STRNCPY |
109 | /** | 109 | /** |
110 | * strncpy - Copy a length-limited, %NUL-terminated string | 110 | * strncpy - Copy a length-limited, C-string |
111 | * @dest: Where to copy the string to | 111 | * @dest: Where to copy the string to |
112 | * @src: Where to copy the string from | 112 | * @src: Where to copy the string from |
113 | * @count: The maximum number of bytes to copy | 113 | * @count: The maximum number of bytes to copy |
@@ -136,7 +136,7 @@ EXPORT_SYMBOL(strncpy); | |||
136 | 136 | ||
137 | #ifndef __HAVE_ARCH_STRLCPY | 137 | #ifndef __HAVE_ARCH_STRLCPY |
138 | /** | 138 | /** |
139 | * strlcpy - Copy a %NUL terminated string into a sized buffer | 139 | * strlcpy - Copy a C-string into a sized buffer |
140 | * @dest: Where to copy the string to | 140 | * @dest: Where to copy the string to |
141 | * @src: Where to copy the string from | 141 | * @src: Where to copy the string from |
142 | * @size: size of destination buffer | 142 | * @size: size of destination buffer |
@@ -182,7 +182,7 @@ EXPORT_SYMBOL(strcat); | |||
182 | 182 | ||
183 | #ifndef __HAVE_ARCH_STRNCAT | 183 | #ifndef __HAVE_ARCH_STRNCAT |
184 | /** | 184 | /** |
185 | * strncat - Append a length-limited, %NUL-terminated string to another | 185 | * strncat - Append a length-limited, C-string to another |
186 | * @dest: The string to be appended to | 186 | * @dest: The string to be appended to |
187 | * @src: The string to append to it | 187 | * @src: The string to append to it |
188 | * @count: The maximum numbers of bytes to copy | 188 | * @count: The maximum numbers of bytes to copy |
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(strncat); | |||
211 | 211 | ||
212 | #ifndef __HAVE_ARCH_STRLCAT | 212 | #ifndef __HAVE_ARCH_STRLCAT |
213 | /** | 213 | /** |
214 | * strlcat - Append a length-limited, %NUL-terminated string to another | 214 | * strlcat - Append a length-limited, C-string to another |
215 | * @dest: The string to be appended to | 215 | * @dest: The string to be appended to |
216 | * @src: The string to append to it | 216 | * @src: The string to append to it |
217 | * @count: The size of the destination buffer. | 217 | * @count: The size of the destination buffer. |
@@ -301,6 +301,24 @@ char *strchr(const char *s, int c) | |||
301 | EXPORT_SYMBOL(strchr); | 301 | EXPORT_SYMBOL(strchr); |
302 | #endif | 302 | #endif |
303 | 303 | ||
304 | #ifndef __HAVE_ARCH_STRCHRNUL | ||
305 | /** | ||
306 | * strchrnul - Find and return a character in a string, or end of string | ||
307 | * @s: The string to be searched | ||
308 | * @c: The character to search for | ||
309 | * | ||
310 | * Returns pointer to first occurrence of 'c' in s. If c is not found, then | ||
311 | * return a pointer to the null byte at the end of s. | ||
312 | */ | ||
313 | char *strchrnul(const char *s, int c) | ||
314 | { | ||
315 | while (*s && *s != (char)c) | ||
316 | s++; | ||
317 | return (char *)s; | ||
318 | } | ||
319 | EXPORT_SYMBOL(strchrnul); | ||
320 | #endif | ||
321 | |||
304 | #ifndef __HAVE_ARCH_STRRCHR | 322 | #ifndef __HAVE_ARCH_STRRCHR |
305 | /** | 323 | /** |
306 | * strrchr - Find the last occurrence of a character in a string | 324 | * strrchr - Find the last occurrence of a character in a string |