summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin2015-03-15 09:57:26 +0000
committersin2015-03-15 09:57:26 +0000
commit442a2a4d6582ac9d3a6f77cd5243e12f86e98891 (patch)
treee0ab440ff5f9dd90c180f95eee952b9a31e9dd59
parent22e7e51007f3a28ded43f6cb8f0ff59a7a691175 (diff)
Hide stpcpy() and stpncpy() under feature test macros
-rw-r--r--include/string.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/string.h b/include/string.h
index 5309cbc..699fa8a 100644
--- a/include/string.h
+++ b/include/string.h
@@ -12,8 +12,6 @@ extern "C" {
12#undef memcpy 12#undef memcpy
13#undef memmove 13#undef memmove
14#undef memset 14#undef memset
15#undef stpcpy
16#undef stpncpy
17#undef strcat 15#undef strcat
18#undef strcpy 16#undef strcpy
19#undef strncat 17#undef strncat
@@ -59,6 +57,10 @@ void *memset(void *dest, int c, size_t n)
59 return __memset_orig(dest, c, n); 57 return __memset_orig(dest, c, n);
60} 58}
61 59
60#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
61 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
62 || defined(_BSD_SOURCE)
63#undef stpcpy
62__typeof__(stpcpy) __stpcpy_orig __asm__(__USER_LABEL_PREFIX__ "stpcpy"); 64__typeof__(stpcpy) __stpcpy_orig __asm__(__USER_LABEL_PREFIX__ "stpcpy");
63extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) 65extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__))
64char *stpcpy(char *dest, const char *src) 66char *stpcpy(char *dest, const char *src)
@@ -70,6 +72,7 @@ char *stpcpy(char *dest, const char *src)
70 return __stpcpy_orig(dest, src); 72 return __stpcpy_orig(dest, src);
71} 73}
72 74
75#undef stpncpy
73__typeof__(stpncpy) __stpncpy_orig __asm__(__USER_LABEL_PREFIX__ "stpncpy"); 76__typeof__(stpncpy) __stpncpy_orig __asm__(__USER_LABEL_PREFIX__ "stpncpy");
74extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) 77extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__))
75char *stpncpy(char *dest, const char *src, size_t n) 78char *stpncpy(char *dest, const char *src, size_t n)
@@ -80,6 +83,7 @@ char *stpncpy(char *dest, const char *src, size_t n)
80 __builtin_trap(); 83 __builtin_trap();
81 return __stpncpy_orig(dest, src, n); 84 return __stpncpy_orig(dest, src, n);
82} 85}
86#endif
83 87
84__typeof__(strcat) __strcat_orig __asm__(__USER_LABEL_PREFIX__ "strcat"); 88__typeof__(strcat) __strcat_orig __asm__(__USER_LABEL_PREFIX__ "strcat");
85extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) 89extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__))