78ef04b608c85c2f2330b82d56fe97187ff6d32c
[openwrt/svn-archive/archive.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 00:52:36.655020316 +0100
5 @@ -326,11 +326,35 @@
6 * They are replaced as proposed by SuSv3. Don't sync this part
7 * with glibc and keep it in sync with strings.h. */
8
9 -# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
10 -# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
11 -# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
12 -# define index(s,c) strchr((s), (c))
13 -# define rindex(s,c) strrchr((s), (c))
14 +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
15 +static inline void bcopy (__const void *__src, void *__dest, size_t __n)
16 +{
17 + memmove(__dest, __src, __n);
18 +}
19 +
20 +/* Set N bytes of S to 0. */
21 +static inline void bzero (void *__s, size_t __n)
22 +{
23 + memset(__s, 0, __n);
24 +}
25 +
26 +/* Compare N bytes of S1 and S2 (same as memcmp). */
27 +static inline int bcmp (__const void *__s1, __const void *__s2, size_t __n)
28 +{
29 + return memcmp(__s1, __s2, __n);
30 +}
31 +
32 +/* Find the first occurrence of C in S (same as strchr). */
33 +static inline char *index (__const char *__s, int __c)
34 +{
35 + return strchr(__s, __c);
36 +}
37 +
38 +/* Find the last occurrence of C in S (same as strrchr). */
39 +static inline char *rindex (__const char *__s, int __c)
40 +{
41 + return strrchr(__s, __c);
42 +}
43 # endif
44 # endif
45
46 Index: uClibc-0.9.29/include/strings.h
47 ===================================================================
48 --- uClibc-0.9.29.orig/include/strings.h 2007-12-30 00:49:00.462700217 +0100
49 +++ uClibc-0.9.29/include/strings.h 2007-12-30 00:52:57.844227820 +0100
50 @@ -58,11 +58,36 @@
51 * They are replaced as proposed by SuSv3. Don't sync this part
52 * with glibc and keep it in sync with string.h. */
53
54 -# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
55 -# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
56 -# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
57 -# define index(s,c) strchr((s), (c))
58 -# define rindex(s,c) strrchr((s), (c))
59 +
60 +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
61 +static inline void bcopy (__const void *__src, void *__dest, size_t __n)
62 +{
63 + memmove(__dest, __src, __n);
64 +}
65 +
66 +/* Set N bytes of S to 0. */
67 +static inline void bzero (void *__s, size_t __n)
68 +{
69 + memset(__s, 0, __n);
70 +}
71 +
72 +/* Compare N bytes of S1 and S2 (same as memcmp). */
73 +static inline int bcmp (__const void *__s1, __const void *__s2, size_t __n)
74 +{
75 + return memcmp(__s1, __s2, __n);
76 +}
77 +
78 +/* Find the first occurrence of C in S (same as strchr). */
79 +static inline char *index (__const char *__s, int __c)
80 +{
81 + return strchr(__s, __c);
82 +}
83 +
84 +/* Find the last occurrence of C in S (same as strrchr). */
85 +static inline char *rindex (__const char *__s, int __c)
86 +{
87 + return strrchr(__s, __c);
88 +}
89 # endif
90 # endif
91