aboutsummaryrefslogtreecommitdiff
path: root/string/strnlen.c
diff options
context:
space:
mode:
authorLiubov Dmitrieva <liubov.dmitrieva@gmail.com>2011-10-23 15:17:23 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-23 15:17:23 -0400
commitfc2ee42abe595bbf6b8bbf0637648ad8b5d4faab (patch)
treed8083a4d8e42366a82963d3525140c53fbb49ede /string/strnlen.c
parent09229f3e1b617d9dcfa3227f32bb72436d7fcac4 (diff)
downloadglibc-fc2ee42abe595bbf6b8bbf0637648ad8b5d4faab.tar
glibc-fc2ee42abe595bbf6b8bbf0637648ad8b5d4faab.tar.gz
glibc-fc2ee42abe595bbf6b8bbf0637648ad8b5d4faab.tar.bz2
glibc-fc2ee42abe595bbf6b8bbf0637648ad8b5d4faab.zip
Add optimized wcslen and strnlen for x86-32
Diffstat (limited to 'string/strnlen.c')
-rw-r--r--string/strnlen.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/string/strnlen.c b/string/strnlen.c
index 454257b2bc..3f52c49b60 100644
--- a/string/strnlen.c
+++ b/string/strnlen.c
@@ -1,5 +1,5 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
- Copyright (C) 1991,1993,1997,2000,2001,2005 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1993, 1997, 2000, 2001, 2005, 2011 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>.
Based on strlen written by Torbjorn Granlund (tege@sics.se),
@@ -26,8 +26,13 @@
/* Find the length of S, but scan at most MAXLEN characters. If no
'\0' terminator is found in that many characters, return MAXLEN. */
+
+#ifndef STRNLEN
+# define STRNLEN __strnlen
+#endif
+
size_t
-__strnlen (const char *str, size_t maxlen)
+STRNLEN (const char *str, size_t maxlen)
{
const char *char_ptr, *end_ptr = str + maxlen;
const unsigned long int *longword_ptr;
@@ -157,5 +162,7 @@ __strnlen (const char *str, size_t maxlen)
char_ptr = end_ptr;
return char_ptr - str;
}
+#ifndef STRNLEN
weak_alias (__strnlen, strnlen)
+#endif
libc_hidden_def (strnlen)