diff options
author | Wilco Dijkstra <wdijkstr@arm.com> | 2016-04-18 15:26:11 +0100 |
---|---|---|
committer | Wilco Dijkstra <wdijkstr@arm.com> | 2016-04-18 15:30:49 +0100 |
commit | d20dce250a6852f5083c05997fc6397c5d438a96 (patch) | |
tree | cfa5b13af699aec13a0540eb949c6dd6bc3d868d /string/bits/string2.h | |
parent | 5379c09148b0925a2af15d10218e8f8c3ec601e9 (diff) | |
download | glibc-d20dce250a6852f5083c05997fc6397c5d438a96.zip glibc-d20dce250a6852f5083c05997fc6397c5d438a96.tar.gz glibc-d20dce250a6852f5083c05997fc6397c5d438a96.tar.bz2 |
Move mempcpy, strcpy and stpcpy inlines to string/string-inlines.c as compatibility
symbols as they are no longer used. Fix compat symbols for __strpbrk inlines.
[BZ #18712]
* string/string-inlines.c (__STRING2_COPY_TYPE): Add, moved from string2.h.
(__old_mempcpy_small): Likewise.
(__old_strcpy_small): Likewise.
(__old_stpcpy_small): Likewise.
(__old_strpbrk_c2): Fix compat symbol name.
(__old_strpbrk_c3): Likewise.
* string/bits/string2.h (__STRING2_COPY_TYPE): Remove.
(__mempcpy_small): Remove.
(__strcpy_small): Remove.
(__stpcpy_small): Remove.
Diffstat (limited to 'string/bits/string2.h')
-rw-r--r-- | string/bits/string2.h | 348 |
1 files changed, 0 insertions, 348 deletions
diff --git a/string/bits/string2.h b/string/bits/string2.h index 9b06bd4..8098760 100644 --- a/string/bits/string2.h +++ b/string/bits/string2.h @@ -46,24 +46,6 @@ # endif #endif -#if _STRING_INLINE_unaligned -# include <bits/types.h> -#else -/* These are a few types we need for the optimizations if we cannot - use unaligned memory accesses. */ -# define __STRING2_COPY_TYPE(N) \ - typedef struct { unsigned char __arr[N]; } \ - __attribute__ ((__packed__)) __STRING2_COPY_ARR##N -__STRING2_COPY_TYPE (2); -__STRING2_COPY_TYPE (3); -__STRING2_COPY_TYPE (4); -__STRING2_COPY_TYPE (5); -__STRING2_COPY_TYPE (6); -__STRING2_COPY_TYPE (7); -__STRING2_COPY_TYPE (8); -# undef __STRING2_COPY_TYPE -#endif - /* Dereferencing a pointer arg to run sizeof on it fails for the void pointer case, so we use this instead. Note that __x is evaluated twice. */ @@ -75,122 +57,7 @@ __STRING2_COPY_TYPE (8); # define __bzero(s, n) __builtin_memset (s, '\0', n) #endif -# if defined _FORCE_INLINES -# if _STRING_INLINE_unaligned -__STRING_INLINE void * -__mempcpy_small (void *__dest1, - char __src0_1, char __src2_1, char __src4_1, char __src6_1, - __uint16_t __src0_2, __uint16_t __src4_2, - __uint32_t __src0_4, __uint32_t __src4_4, - size_t __srclen) -{ - union { - __uint32_t __ui; - __uint16_t __usi; - unsigned char __uc; - unsigned char __c; - } *__u = __dest1; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = __src0_1; - __u = __extension__ ((void *) __u + 1); - break; - case 2: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - break; - case 3: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - __u->__c = __src2_1; - __u = __extension__ ((void *) __u + 1); - break; - case 4: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - break; - case 5: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__c = __src4_1; - __u = __extension__ ((void *) __u + 1); - break; - case 6: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - break; - case 7: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - __u->__c = __src6_1; - __u = __extension__ ((void *) __u + 1); - break; - case 8: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__ui = __src4_4; - __u = __extension__ ((void *) __u + 4); - break; - } - return (void *) __u; -} -# else -__STRING_INLINE void * -__mempcpy_small (void *__dest, char __src1, - __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, - __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, - __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, - __STRING2_COPY_ARR8 __src8, size_t __srclen) -{ - union { - char __c; - __STRING2_COPY_ARR2 __sca2; - __STRING2_COPY_ARR3 __sca3; - __STRING2_COPY_ARR4 __sca4; - __STRING2_COPY_ARR5 __sca5; - __STRING2_COPY_ARR6 __sca6; - __STRING2_COPY_ARR7 __sca7; - __STRING2_COPY_ARR8 __sca8; - } *__u = __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = __src1; - break; - case 2: - __extension__ __u->__sca2 = __src2; - break; - case 3: - __extension__ __u->__sca3 = __src3; - break; - case 4: - __extension__ __u->__sca4 = __src4; - break; - case 5: - __extension__ __u->__sca5 = __src5; - break; - case 6: - __extension__ __u->__sca6 = __src6; - break; - case 7: - __extension__ __u->__sca7 = __src7; - break; - case 8: - __extension__ __u->__sca8 = __src8; - break; - } - return __extension__ ((void *) __u + __srclen); -} -# endif -#endif - -/* Return pointer to C in S. */ #ifndef _HAVE_STRING_ARCH_strchr extern void *__rawmemchr (const void *__s, int __c); # define strchr(s, c) \ @@ -201,112 +68,6 @@ extern void *__rawmemchr (const void *__s, int __c); #endif -/* Copy SRC to DEST. */ -#if defined _FORCE_INLINES -# if _STRING_INLINE_unaligned -__STRING_INLINE char * -__strcpy_small (char *__dest, - __uint16_t __src0_2, __uint16_t __src4_2, - __uint32_t __src0_4, __uint32_t __src4_4, - size_t __srclen) -{ - union { - __uint32_t __ui; - __uint16_t __usi; - unsigned char __uc; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__uc = '\0'; - break; - case 2: - __u->__usi = __src0_2; - break; - case 3: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 4: - __u->__ui = __src0_4; - break; - case 5: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__uc = '\0'; - break; - case 6: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - break; - case 7: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 8: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__ui = __src4_4; - break; - } - return __dest; -} -# else -__STRING_INLINE char * -__strcpy_small (char *__dest, - __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, - __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, - __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, - __STRING2_COPY_ARR8 __src8, size_t __srclen) -{ - union { - char __c; - __STRING2_COPY_ARR2 __sca2; - __STRING2_COPY_ARR3 __sca3; - __STRING2_COPY_ARR4 __sca4; - __STRING2_COPY_ARR5 __sca5; - __STRING2_COPY_ARR6 __sca6; - __STRING2_COPY_ARR7 __sca7; - __STRING2_COPY_ARR8 __sca8; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = '\0'; - break; - case 2: - __extension__ __u->__sca2 = __src2; - break; - case 3: - __extension__ __u->__sca3 = __src3; - break; - case 4: - __extension__ __u->__sca4 = __src4; - break; - case 5: - __extension__ __u->__sca5 = __src5; - break; - case 6: - __extension__ __u->__sca6 = __src6; - break; - case 7: - __extension__ __u->__sca7 = __src7; - break; - case 8: - __extension__ __u->__sca8 = __src8; - break; - } - return __dest; -} -# endif -#endif - - /* Copy SRC to DEST, returning pointer to final NUL byte. */ #ifdef __USE_GNU # ifndef _HAVE_STRING_ARCH_stpcpy @@ -315,115 +76,6 @@ __strcpy_small (char *__dest, we have to use the name `__stpcpy'. */ # define stpcpy(dest, src) __stpcpy (dest, src) # endif - -# if defined _FORCE_INLINES -# if _STRING_INLINE_unaligned -__STRING_INLINE char * -__stpcpy_small (char *__dest, - __uint16_t __src0_2, __uint16_t __src4_2, - __uint32_t __src0_4, __uint32_t __src4_4, - size_t __srclen) -{ - union { - unsigned int __ui; - unsigned short int __usi; - unsigned char __uc; - char __c; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__uc = '\0'; - break; - case 2: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 1); - break; - case 3: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 4: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 3); - break; - case 5: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__uc = '\0'; - break; - case 6: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 1); - break; - case 7: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 8: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__ui = __src4_4; - __u = __extension__ ((void *) __u + 3); - break; - } - return &__u->__c; -} -# else -__STRING_INLINE char * -__stpcpy_small (char *__dest, - __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, - __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, - __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, - __STRING2_COPY_ARR8 __src8, size_t __srclen) -{ - union { - char __c; - __STRING2_COPY_ARR2 __sca2; - __STRING2_COPY_ARR3 __sca3; - __STRING2_COPY_ARR4 __sca4; - __STRING2_COPY_ARR5 __sca5; - __STRING2_COPY_ARR6 __sca6; - __STRING2_COPY_ARR7 __sca7; - __STRING2_COPY_ARR8 __sca8; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = '\0'; - break; - case 2: - __extension__ __u->__sca2 = __src2; - break; - case 3: - __extension__ __u->__sca3 = __src3; - break; - case 4: - __extension__ __u->__sca4 = __src4; - break; - case 5: - __extension__ __u->__sca5 = __src5; - break; - case 6: - __extension__ __u->__sca6 = __src6; - break; - case 7: - __extension__ __u->__sca7 = __src7; - break; - case 8: - __extension__ __u->__sca8 = __src8; - break; - } - return __dest + __srclen - 1; -} -# endif -# endif #endif |