diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-10-23 16:30:40 -0400 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-10-23 16:30:40 -0400 |
commit | 2fa2ae85cadef6af47826dcddfb4e6d8a4c8b5a3 (patch) | |
tree | d5735921e19a1dcbf3de1e9006c921baedda7ae4 /string | |
parent | fc2ee42abe595bbf6b8bbf0637648ad8b5d4faab (diff) | |
download | glibc-2fa2ae85cadef6af47826dcddfb4e6d8a4c8b5a3.zip glibc-2fa2ae85cadef6af47826dcddfb4e6d8a4c8b5a3.tar.gz glibc-2fa2ae85cadef6af47826dcddfb4e6d8a4c8b5a3.tar.bz2 |
Fix strnlen change
Diffstat (limited to 'string')
-rw-r--r-- | string/strnlen.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/string/strnlen.c b/string/strnlen.c index 3f52c49..d083ec2 100644 --- a/string/strnlen.c +++ b/string/strnlen.c @@ -27,16 +27,16 @@ /* 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 +#ifdef 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; - unsigned long int longword, magic_bits, himagic, lomagic; + unsigned long int longword, himagic, lomagic; if (maxlen == 0) return 0; @@ -70,14 +70,12 @@ STRNLEN (const char *str, size_t maxlen) The 1-bits make sure that carries propagate to the next 0-bit. The 0-bits provide holes for carries to fall into. */ - magic_bits = 0x7efefeffL; himagic = 0x80808080L; lomagic = 0x01010101L; if (sizeof (longword) > 4) { /* 64-bit version of the magic. */ /* Do the shift in two steps to avoid a warning if long has 32 bits. */ - magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; himagic = ((himagic << 16) << 16) | himagic; lomagic = ((lomagic << 16) << 16) | lomagic; } |