nptl: Fix tst-cancel30 on sparc64
[glibc.git] / sysdeps / i386 / string-inlines.c
blob618ecdf4f1a5bce1967cac010b363ee3ac1a8c9e
1 /* Copyright (C) 1999-2023 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
18 #include <string/string-inlines.c>
20 #if SHLIB_COMPAT (libc, GLIBC_2_1_1, GLIBC_2_26)
21 /* Additional compatibility shims for the former
22 sysdeps/x86/bits/string.h. */
23 void *
24 __old_memcpy_c (void *d, const void *s, size_t n)
26 return memcpy (d, s, n);
28 strong_alias (__old_memcpy_c, __old_memcpy_g);
29 strong_alias (__old_memcpy_c, __old_memcpy_by4);
30 strong_alias (__old_memcpy_c, __old_memcpy_by2);
31 compat_symbol (libc, __old_memcpy_c, __memcpy_c, GLIBC_2_1_1);
32 compat_symbol (libc, __old_memcpy_g, __memcpy_g, GLIBC_2_1_1);
33 compat_symbol (libc, __old_memcpy_by4, __memcpy_by4, GLIBC_2_1_1);
34 compat_symbol (libc, __old_memcpy_by2, __memcpy_by2, GLIBC_2_1_1);
36 void *
37 __old_memset_cc (void *s, unsigned long int pattern, size_t n)
39 return memset (s, pattern & 0xff, n);
41 strong_alias (__old_memset_cc, __old_memset_cg);
42 strong_alias (__old_memset_cc, __old_memset_ccn_by2);
43 strong_alias (__old_memset_cc, __old_memset_ccn_by4);
44 compat_symbol (libc, __old_memset_cc, __memset_cc, GLIBC_2_1_1);
45 compat_symbol (libc, __old_memset_cg, __memset_cg, GLIBC_2_1_1);
46 compat_symbol (libc, __old_memset_ccn_by4, __memset_ccn_by4, GLIBC_2_1_1);
47 compat_symbol (libc, __old_memset_ccn_by2, __memset_ccn_by2, GLIBC_2_1_1);
49 void *
50 __old_memset_gg (void *s, char c, size_t n)
52 return memset (s, c, n);
54 strong_alias (__old_memset_gg, __old_memset_gcn_by4);
55 strong_alias (__old_memset_gg, __old_memset_gcn_by2);
56 compat_symbol (libc, __old_memset_gg, __memset_gg, GLIBC_2_1_1);
57 compat_symbol (libc, __old_memset_gcn_by4, __memset_gcn_by4, GLIBC_2_1_1);
58 compat_symbol (libc, __old_memset_gcn_by2, __memset_gcn_by2, GLIBC_2_1_1);
60 size_t
61 __old_strlen_g (const char *str)
63 return strlen (str);
65 compat_symbol (libc, __old_strlen_g, __strlen_g, GLIBC_2_1_1);
67 char *
68 __old_strcpy_g (char *dest, const char *src)
70 return strcpy (dest, src);
72 compat_symbol (libc, __old_strcpy_g, __strcpy_g, GLIBC_2_1_1);
74 void *
75 __old_mempcpy_byn (void *dest, const void *src, size_t len)
77 return __mempcpy (dest, src, len);
79 strong_alias (__old_mempcpy_byn, __old_mempcpy_by4);
80 strong_alias (__old_mempcpy_byn, __old_mempcpy_by2);
81 compat_symbol (libc, __old_mempcpy_byn, __mempcpy_byn, GLIBC_2_1_1);
82 compat_symbol (libc, __old_mempcpy_by4, __mempcpy_by4, GLIBC_2_1_1);
83 compat_symbol (libc, __old_mempcpy_by2, __mempcpy_by2, GLIBC_2_1_1);
85 char *
86 __old_stpcpy_g (char *dest, const char *src)
88 return __stpcpy (dest, src);
90 compat_symbol (libc, __old_stpcpy_g, __stpcpy_g, GLIBC_2_1_1);
92 char *
93 __old_strncpy_byn (char *dest, const char *src, size_t srclen, size_t n)
95 return strncpy (dest, src, n);
97 strong_alias (__old_strncpy_byn, __old_strncpy_by4);
98 strong_alias (__old_strncpy_byn, __old_strncpy_by2);
99 compat_symbol (libc, __old_strncpy_byn, __strncpy_byn, GLIBC_2_1_1);
100 compat_symbol (libc, __old_strncpy_by4, __strncpy_by4, GLIBC_2_1_1);
101 compat_symbol (libc, __old_strncpy_by2, __strncpy_by2, GLIBC_2_1_1);
103 char *
104 __old_strncpy_gg (char *dest, const char *src, size_t n)
106 return strncpy (dest, src, n);
108 compat_symbol (libc, __old_strncpy_gg, __strncpy_gg, GLIBC_2_1_1);
110 /* __strcat_c took a third argument, which we ignore. */
111 char *
112 __old_strcat_g (char *dest, const char *src)
114 return strcat (dest, src);
116 strong_alias (__old_strcat_g, __old_strcat_c);
117 compat_symbol (libc, __old_strcat_g, __strcat_g, GLIBC_2_1_1);
118 compat_symbol (libc, __old_strcat_c, __strcat_c, GLIBC_2_1_1);
120 char *
121 __old_strncat_g (char *dest, const char *src, size_t n)
123 return __strncat (dest, src, n);
125 compat_symbol (libc, __old_strncat_g, __strncat_g, GLIBC_2_1_1);
128 __old_strcmp_gg (const char *s1, const char *s2)
130 return strcmp (s1, s2);
132 compat_symbol (libc, __old_strcmp_gg, __strcmp_gg, GLIBC_2_1_1);
135 __old_strncmp_g (const char *s1, const char *s2, size_t n)
137 return strncmp (s1, s2, n);
139 compat_symbol (libc, __old_strncmp_g, __strncmp_g, GLIBC_2_1_1);
141 char *
142 __old_strchr_g (const char *s, int c)
144 return strchr (s, c);
146 strong_alias (__old_strchr_g, __old_strchr_c);
147 compat_symbol (libc, __old_strchr_g, __strchr_g, GLIBC_2_1_1);
148 compat_symbol (libc, __old_strchr_c, __strchr_c, GLIBC_2_1_1);
150 char *
151 __old_strchrnul_g (const char *s, int c)
153 return __strchrnul (s, c);
155 strong_alias (__old_strchrnul_g, __old_strchrnul_c);
156 compat_symbol (libc, __old_strchrnul_g, __strchrnul_g, GLIBC_2_1_1);
157 compat_symbol (libc, __old_strchrnul_c, __strchrnul_c, GLIBC_2_1_1);
159 char *
160 __old_strrchr_g (const char *s, int c)
162 return strrchr (s, c);
164 strong_alias (__old_strrchr_g, __old_strrchr_c);
165 compat_symbol (libc, __old_strrchr_g, __strrchr_g, GLIBC_2_1_1);
166 compat_symbol (libc, __old_strrchr_c, __strrchr_c, GLIBC_2_1_1);
168 /* __strcspn_cg took a third argument, which we ignore. */
169 size_t
170 __old_strcspn_g (const char *s, const char *reject)
172 return strcspn (s, reject);
174 strong_alias (__old_strcspn_g, __old_strcspn_cg);
175 compat_symbol (libc, __old_strcspn_g, __strcspn_g, GLIBC_2_1_1);
176 compat_symbol (libc, __old_strcspn_cg, __strcspn_cg, GLIBC_2_1_1);
178 /* __strspn_cg took a third argument, which we ignore. */
179 size_t
180 __old_strspn_g (const char *s, const char *accept)
182 return strspn (s, accept);
184 strong_alias (__old_strspn_g, __old_strspn_cg);
185 compat_symbol (libc, __old_strspn_g, __strspn_g, GLIBC_2_1_1);
186 compat_symbol (libc, __old_strspn_cg, __strspn_cg, GLIBC_2_1_1);
188 /* __strpbrk_cg took a third argument, which we ignore. */
189 const char *
190 __old_strpbrk_g (const char *s, const char *accept)
192 return strpbrk (s, accept);
194 strong_alias (__old_strpbrk_g, __old_strpbrk_cg);
195 compat_symbol (libc, __old_strpbrk_g, __strpbrk_g, GLIBC_2_1_1);
196 compat_symbol (libc, __old_strpbrk_cg, __strpbrk_cg, GLIBC_2_1_1);
198 /* __strstr_cg took a third argument, which we ignore. */
199 const char *
200 __old_strstr_g (const char *s, const char *accept)
202 return strstr (s, accept);
204 strong_alias (__old_strstr_g, __old_strstr_cg);
205 compat_symbol (libc, __old_strstr_g, __strstr_g, GLIBC_2_1_1);
206 compat_symbol (libc, __old_strstr_cg, __strstr_cg, GLIBC_2_1_1);
208 #endif