/[gentoo-x86]/dev-util/valgrind/files/valgrind-3.6.0-strcasecmp.patch
Gentoo

Contents of /dev-util/valgrind/files/valgrind-3.6.0-strcasecmp.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Thu Jan 27 04:51:32 2011 UTC (3 years, 7 months ago) by ssuominen
Branch: MAIN
Fix compability with recent glibc release.

(Portage version: 2.2.0_alpha19/cvs/Linux x86_64)

1 http://pkgs.fedoraproject.org/gitweb/?p=valgrind.git;a=summary
2
3 --- valgrind/memcheck/mc_replace_strmem.c
4 +++ valgrind/memcheck/mc_replace_strmem.c
5 @@ -431,6 +430,111 @@ STRCMP(VG_Z_LD64_SO_1, strcmp
6 #endif
7
8
9 +#if defined(VGO_linux)
10 +extern int tolower (int);
11 +
12 +#define STRCASECMP(soname, fnname) \
13 + int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
14 + ( const char* s1, const char* s2 ); \
15 + int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
16 + ( const char* s1, const char* s2 ) \
17 + { \
18 + register unsigned char c1; \
19 + register unsigned char c2; \
20 + while (True) { \
21 + c1 = tolower(*(unsigned char *)s1); \
22 + c2 = tolower(*(unsigned char *)s2); \
23 + if (c1 != c2) break; \
24 + if (c1 == 0) break; \
25 + s1++; s2++; \
26 + } \
27 + if (c1 < c2) return -1; \
28 + if (c1 > c2) return 1; \
29 + return 0; \
30 + }
31 +
32 +STRCASECMP(VG_Z_LIBC_SONAME, strcasecmp)
33 +STRCASECMP(VG_Z_LIBC_SONAME, __GI_strcasecmp)
34 +
35 +
36 +#define STRNCASECMP(soname, fnname) \
37 + int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
38 + ( const char* s1, const char* s2, SizeT nmax ); \
39 + int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
40 + ( const char* s1, const char* s2, SizeT nmax ) \
41 + { \
42 + register unsigned char c1; \
43 + register unsigned char c2; \
44 + SizeT n = 0; \
45 + while (True) { \
46 + if (n >= nmax) return 0; \
47 + if (*s1 == 0 && *s2 == 0) return 0; \
48 + if (*s1 == 0) return -1; \
49 + if (*s2 == 0) return 1; \
50 + c1 = tolower(*(unsigned char*)s1); \
51 + c2 = tolower(*(unsigned char*)s2); \
52 + if (c1 < c2) return -1; \
53 + if (c1 > c2) return 1; \
54 + s1++; s2++; n++; \
55 + } \
56 + }
57 +
58 +STRNCASECMP(VG_Z_LIBC_SONAME, strncasecmp)
59 +STRNCASECMP(VG_Z_LIBC_SONAME, __GI_strncasecmp)
60 +
61 +extern int tolower_l (int, void *) __attribute__((weak));
62 +
63 +#define STRCASECMP_L(soname, fnname) \
64 + int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
65 + ( const char* s1, const char* s2, void* l ); \
66 + int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
67 + ( const char* s1, const char* s2, void* l ) \
68 + { \
69 + register unsigned char c1; \
70 + register unsigned char c2; \
71 + while (True) { \
72 + c1 = tolower_l(*(unsigned char *)s1, l); \
73 + c2 = tolower_l(*(unsigned char *)s2, l); \
74 + if (c1 != c2) break; \
75 + if (c1 == 0) break; \
76 + s1++; s2++; \
77 + } \
78 + if (c1 < c2) return -1; \
79 + if (c1 > c2) return 1; \
80 + return 0; \
81 + }
82 +
83 +STRCASECMP_L(VG_Z_LIBC_SONAME, strcasecmp_l)
84 +STRCASECMP_L(VG_Z_LIBC_SONAME, __GI_strcasecmp_l)
85 +
86 +
87 +#define STRNCASECMP_L(soname, fnname) \
88 + int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
89 + ( const char* s1, const char* s2, SizeT nmax, void* l ); \
90 + int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
91 + ( const char* s1, const char* s2, SizeT nmax, void* l ) \
92 + { \
93 + register unsigned char c1; \
94 + register unsigned char c2; \
95 + SizeT n = 0; \
96 + while (True) { \
97 + if (n >= nmax) return 0; \
98 + if (*s1 == 0 && *s2 == 0) return 0; \
99 + if (*s1 == 0) return -1; \
100 + if (*s2 == 0) return 1; \
101 + c1 = tolower_l(*(unsigned char*)s1, l); \
102 + c2 = tolower_l(*(unsigned char*)s2, l); \
103 + if (c1 < c2) return -1; \
104 + if (c1 > c2) return 1; \
105 + s1++; s2++; n++; \
106 + } \
107 + }
108 +
109 +STRNCASECMP_L(VG_Z_LIBC_SONAME, strncasecmp_l)
110 +STRNCASECMP_L(VG_Z_LIBC_SONAME, __GI_strncasecmp_l)
111 +#endif
112 +
113 +
114 #define MEMCHR(soname, fnname) \
115 void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const void *s, int c, SizeT n); \
116 void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const void *s, int c, SizeT n) \

  ViewVC Help
Powered by ViewVC 1.1.20