do target dependent optimizations
[openwrt.git] / toolchain / uClibc / patches / 110-compat_macros.patch
1 Index: uClibc-0.9.29/include/string.h
2 ===================================================================
3 --- uClibc-0.9.29.orig/include/string.h 2007-12-30 00:44:19.638696968 +0100
4 +++ uClibc-0.9.29/include/string.h 2007-12-30 01:12:52.097715154 +0100
5 @@ -320,18 +320,40 @@
6 /* Find the last occurrence of C in S (same as strrchr). */
7 extern char *rindex (__const char *__s, int __c)
8 __THROW __attribute_pure__ __nonnull ((1));
9 -# else
10 -# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__
11 +# elif defined(__UCLIBC_SUSV3_LEGACY_MACROS__) && !defined(_STRINGS_H)
12 /* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
13 * They are replaced as proposed by SuSv3. Don't sync this part
14 * with glibc and keep it in sync with strings.h. */
15
16 -# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
17 -# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
18 -# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
19 -# define index(s,c) strchr((s), (c))
20 -# define rindex(s,c) strrchr((s), (c))
21 -# endif
22 +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
23 +static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
24 +{
25 + memmove(__dest, __src, __n);
26 +}
27 +
28 +/* Set N bytes of S to 0. */
29 +static __inline__ void bzero (void *__s, size_t __n)
30 +{
31 + memset(__s, 0, __n);
32 +}
33 +
34 +/* Compare N bytes of S1 and S2 (same as memcmp). */
35 +static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
36 +{
37 + return memcmp(__s1, __s2, __n);
38 +}
39 +
40 +/* Find the first occurrence of C in S (same as strchr). */
41 +static __inline__ char *index (__const char *__s, int __c)
42 +{
43 + return strchr(__s, __c);
44 +}
45 +
46 +/* Find the last occurrence of C in S (same as strrchr). */
47 +static __inline__ char *rindex (__const char *__s, int __c)
48 +{
49 + return strrchr(__s, __c);
50 +}
51 # endif
52
53 /* Return the position of the first bit set in I, or 0 if none are set.
54 Index: uClibc-0.9.29/include/strings.h
55 ===================================================================
56 --- uClibc-0.9.29.orig/include/strings.h 2007-12-30 00:49:00.462700217 +0100
57 +++ uClibc-0.9.29/include/strings.h 2007-12-30 00:52:57.844227820 +0100
58 @@ -58,11 +58,36 @@
59 * They are replaced as proposed by SuSv3. Don't sync this part
60 * with glibc and keep it in sync with string.h. */
61
62 -# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
63 -# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
64 -# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
65 -# define index(s,c) strchr((s), (c))
66 -# define rindex(s,c) strrchr((s), (c))
67 +
68 +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
69 +static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
70 +{
71 + memmove(__dest, __src, __n);
72 +}
73 +
74 +/* Set N bytes of S to 0. */
75 +static __inline__ void bzero (void *__s, size_t __n)
76 +{
77 + memset(__s, 0, __n);
78 +}
79 +
80 +/* Compare N bytes of S1 and S2 (same as memcmp). */
81 +static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
82 +{
83 + return memcmp(__s1, __s2, __n);
84 +}
85 +
86 +/* Find the first occurrence of C in S (same as strchr). */
87 +static __inline__ char *index (__const char *__s, int __c)
88 +{
89 + return strchr(__s, __c);
90 +}
91 +
92 +/* Find the last occurrence of C in S (same as strrchr). */
93 +static __inline__ char *rindex (__const char *__s, int __c)
94 +{
95 + return strrchr(__s, __c);
96 +}
97 # endif
98 # endif
99
This page took 0.045873 seconds and 5 git commands to generate.