diff options
Diffstat (limited to 'newlib/libc/machine/mips/strncpy.c')
-rw-r--r-- | newlib/libc/machine/mips/strncpy.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/newlib/libc/machine/mips/strncpy.c b/newlib/libc/machine/mips/strncpy.c index 47413cb7c..a2ceb2c77 100644 --- a/newlib/libc/machine/mips/strncpy.c +++ b/newlib/libc/machine/mips/strncpy.c @@ -18,7 +18,6 @@ #include <string.h> #include <stddef.h> #include <stdlib.h> -#include <stdint.h> #if !defined(__GNUC__) || (__GNUC__ < 3) #define __builtin_expect(a,b) a @@ -83,26 +82,6 @@ strncpy (char *dst0, const char *src0, size_t count) dst = (unsigned char *)dst0; src = (unsigned const char *)src0; - /* Take care of any odd bytes in the source data because we - * want to unroll where we read ahead 2 or 4 bytes at a time and then - * check each byte for the null terminator. This can result in - * a segfault for the case where the source pointer is unaligned, - * the null terminator is in valid memory, but reading 2 or 4 bytes at a - * time blindly eventually goes outside of valid memory. */ - while (((uintptr_t) src & (UNROLL_FACTOR - 1)) != 0 && count > 0) - { - *dst++ = ch = *src++; - --count; - if (ch == '\0') - { - end = dst + count; - while (dst != end) - *dst++ = '\0'; - - return dst0; - } - } - if (__builtin_expect (count >= 4, 1)) { odd_bytes = (count & (UNROLL_FACTOR - 1)); |