aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/string.c b/lib/string.c
index 10063300b830..ce81aaec3839 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -58,14 +58,6 @@ int strncasecmp(const char *s1, const char *s2, size_t len)
58} 58}
59EXPORT_SYMBOL(strncasecmp); 59EXPORT_SYMBOL(strncasecmp);
60#endif 60#endif
61#ifndef __HAVE_ARCH_STRNICMP
62#undef strnicmp
63int strnicmp(const char *s1, const char *s2, size_t len)
64{
65 return strncasecmp(s1, s2, len);
66}
67EXPORT_SYMBOL(strnicmp);
68#endif
69 61
70#ifndef __HAVE_ARCH_STRCASECMP 62#ifndef __HAVE_ARCH_STRCASECMP
71int strcasecmp(const char *s1, const char *s2) 63int strcasecmp(const char *s1, const char *s2)
@@ -321,12 +313,12 @@ EXPORT_SYMBOL(strchrnul);
321 */ 313 */
322char *strrchr(const char *s, int c) 314char *strrchr(const char *s, int c)
323{ 315{
324 const char *p = s + strlen(s); 316 const char *last = NULL;
325 do { 317 do {
326 if (*p == (char)c) 318 if (*s == (char)c)
327 return (char *)p; 319 last = s;
328 } while (--p >= s); 320 } while (*s++);
329 return NULL; 321 return (char *)last;
330} 322}
331EXPORT_SYMBOL(strrchr); 323EXPORT_SYMBOL(strrchr);
332#endif 324#endif
@@ -604,6 +596,11 @@ EXPORT_SYMBOL(memset);
604 * @s: Pointer to the start of the area. 596 * @s: Pointer to the start of the area.
605 * @count: The size of the area. 597 * @count: The size of the area.
606 * 598 *
599 * Note: usually using memset() is just fine (!), but in cases
600 * where clearing out _local_ data at the end of a scope is
601 * necessary, memzero_explicit() should be used instead in
602 * order to prevent the compiler from optimising away zeroing.
603 *
607 * memzero_explicit() doesn't need an arch-specific version as 604 * memzero_explicit() doesn't need an arch-specific version as
608 * it just invokes the one of memset() implicitly. 605 * it just invokes the one of memset() implicitly.
609 */ 606 */