[etrax] dump 2.6.25 support
[openwrt-10.03/.git] / toolchain / uClibc / patches-0.9.29 / 110-compat_macros.patch
1 --- a/include/string.h
2 +++ b/include/string.h
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));
7 -# else
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.  */
13  
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))
19 -#  endif
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)
22 +{
23 +       memmove(__dest, __src, __n);
24 +}
25 +
26 +/* Set N bytes of S to 0.  */
27 +static __inline__ void bzero (void *__s, size_t __n)
28 +{
29 +       memset(__s, 0, __n);
30 +}
31 +
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)
34 +{
35 +       return memcmp(__s1, __s2, __n);
36 +}
37 +
38 +/* Find the first occurrence of C in S (same as strchr).  */
39 +static __inline__ char *index (__const char *__s, int __c)
40 +{
41 +       return strchr(__s, __c);
42 +}
43 +
44 +/* Find the last occurrence of C in S (same as strrchr).  */
45 +static __inline__ char *rindex (__const char *__s, int __c)
46 +{
47 +       return strrchr(__s, __c);
48 +}
49  # endif
50  
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.  */
57  
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))
63 +
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)
66 +{
67 +       memmove(__dest, __src, __n);
68 +}
69 +
70 +/* Set N bytes of S to 0.  */
71 +static __inline__ void bzero (void *__s, size_t __n)
72 +{
73 +       memset(__s, 0, __n);
74 +}
75 +
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)
78 +{
79 +       return memcmp(__s1, __s2, __n);
80 +}
81 +
82 +/* Find the first occurrence of C in S (same as strchr).  */
83 +static __inline__ char *index (__const char *__s, int __c)
84 +{
85 +       return strchr(__s, __c);
86 +}
87 +
88 +/* Find the last occurrence of C in S (same as strrchr).  */
89 +static __inline__ char *rindex (__const char *__s, int __c)
90 +{
91 +       return strrchr(__s, __c);
92 +}
93  #  endif
94  # endif
95