3 @@ -320,18 +320,40 @@ extern char *index (__const char *__s, i
4 /* Find the last occurrence of C in S (same as strrchr). */
5 extern char *rindex (__const char *__s, int __c)
6 __THROW __attribute_pure__ __nonnull ((1));
8 -# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__
9 +# elif defined(__UCLIBC_SUSV3_LEGACY_MACROS__) && !defined(_STRINGS_H)
10 /* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
11 * They are replaced as proposed by SuSv3. Don't sync this part
12 * with glibc and keep it in sync with strings.h. */
14 -# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
15 -# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
16 -# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
17 -# define index(s,c) strchr((s), (c))
18 -# define rindex(s,c) strrchr((s), (c))
20 +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
21 +static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
23 + memmove(__dest, __src, __n);
26 +/* Set N bytes of S to 0. */
27 +static __inline__ void bzero (void *__s, size_t __n)
29 + memset(__s, 0, __n);
32 +/* Compare N bytes of S1 and S2 (same as memcmp). */
33 +static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
35 + return memcmp(__s1, __s2, __n);
38 +/* Find the first occurrence of C in S (same as strchr). */
39 +static __inline__ char *index (__const char *__s, int __c)
41 + return strchr(__s, __c);
44 +/* Find the last occurrence of C in S (same as strrchr). */
45 +static __inline__ char *rindex (__const char *__s, int __c)
47 + return strrchr(__s, __c);
51 /* Return the position of the first bit set in I, or 0 if none are set.
52 --- a/include/strings.h
53 +++ b/include/strings.h
54 @@ -58,11 +58,36 @@ extern char *rindex (__const char *__s,
55 * They are replaced as proposed by SuSv3. Don't sync this part
56 * with glibc and keep it in sync with string.h. */
58 -# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
59 -# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
60 -# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
61 -# define index(s,c) strchr((s), (c))
62 -# define rindex(s,c) strrchr((s), (c))
64 +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
65 +static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
67 + memmove(__dest, __src, __n);
70 +/* Set N bytes of S to 0. */
71 +static __inline__ void bzero (void *__s, size_t __n)
73 + memset(__s, 0, __n);
76 +/* Compare N bytes of S1 and S2 (same as memcmp). */
77 +static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
79 + return memcmp(__s1, __s2, __n);
82 +/* Find the first occurrence of C in S (same as strchr). */
83 +static __inline__ char *index (__const char *__s, int __c)
85 + return strchr(__s, __c);
88 +/* Find the last occurrence of C in S (same as strrchr). */
89 +static __inline__ char *rindex (__const char *__s, int __c)
91 + return strrchr(__s, __c);