1/* Copyright (C) 1999-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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/>. */
17
18#include <string/string-inlines.c>
19
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. */
23void *
24__old_memcpy_c (void *d, const void *s, size_t n)
25{
26 return memcpy (d, s, n);
27}
28strong_alias (__old_memcpy_c, __old_memcpy_g);
29strong_alias (__old_memcpy_c, __old_memcpy_by4);
30strong_alias (__old_memcpy_c, __old_memcpy_by2);
31compat_symbol (libc, __old_memcpy_c, __memcpy_c, GLIBC_2_1_1);
32compat_symbol (libc, __old_memcpy_g, __memcpy_g, GLIBC_2_1_1);
33compat_symbol (libc, __old_memcpy_by4, __memcpy_by4, GLIBC_2_1_1);
34compat_symbol (libc, __old_memcpy_by2, __memcpy_by2, GLIBC_2_1_1);
35
36void *
37__old_memset_cc (void *s, unsigned long int pattern, size_t n)
38{
39 return memset (s, pattern & 0xff, n);
40}
41strong_alias (__old_memset_cc, __old_memset_cg);
42strong_alias (__old_memset_cc, __old_memset_ccn_by2);
43strong_alias (__old_memset_cc, __old_memset_ccn_by4);
44compat_symbol (libc, __old_memset_cc, __memset_cc, GLIBC_2_1_1);
45compat_symbol (libc, __old_memset_cg, __memset_cg, GLIBC_2_1_1);
46compat_symbol (libc, __old_memset_ccn_by4, __memset_ccn_by4, GLIBC_2_1_1);
47compat_symbol (libc, __old_memset_ccn_by2, __memset_ccn_by2, GLIBC_2_1_1);
48
49void *
50__old_memset_gg (void *s, char c, size_t n)
51{
52 return memset (s, c, n);
53}
54strong_alias (__old_memset_gg, __old_memset_gcn_by4);
55strong_alias (__old_memset_gg, __old_memset_gcn_by2);
56compat_symbol (libc, __old_memset_gg, __memset_gg, GLIBC_2_1_1);
57compat_symbol (libc, __old_memset_gcn_by4, __memset_gcn_by4, GLIBC_2_1_1);
58compat_symbol (libc, __old_memset_gcn_by2, __memset_gcn_by2, GLIBC_2_1_1);
59
60size_t
61__old_strlen_g (const char *str)
62{
63 return strlen (str);
64}
65compat_symbol (libc, __old_strlen_g, __strlen_g, GLIBC_2_1_1);
66
67char *
68__old_strcpy_g (char *dest, const char *src)
69{
70 return strcpy (dest, src);
71}
72compat_symbol (libc, __old_strcpy_g, __strcpy_g, GLIBC_2_1_1);
73
74void *
75__old_mempcpy_byn (void *dest, const void *src, size_t len)
76{
77 return __mempcpy (dest, src, len);
78}
79strong_alias (__old_mempcpy_byn, __old_mempcpy_by4);
80strong_alias (__old_mempcpy_byn, __old_mempcpy_by2);
81compat_symbol (libc, __old_mempcpy_byn, __mempcpy_byn, GLIBC_2_1_1);
82compat_symbol (libc, __old_mempcpy_by4, __mempcpy_by4, GLIBC_2_1_1);
83compat_symbol (libc, __old_mempcpy_by2, __mempcpy_by2, GLIBC_2_1_1);
84
85char *
86__old_stpcpy_g (char *dest, const char *src)
87{
88 return __stpcpy (dest, src);
89}
90compat_symbol (libc, __old_stpcpy_g, __stpcpy_g, GLIBC_2_1_1);
91
92char *
93__old_strncpy_byn (char *dest, const char *src, size_t srclen, size_t n)
94{
95 return strncpy (dest, src, n);
96}
97strong_alias (__old_strncpy_byn, __old_strncpy_by4);
98strong_alias (__old_strncpy_byn, __old_strncpy_by2);
99compat_symbol (libc, __old_strncpy_byn, __strncpy_byn, GLIBC_2_1_1);
100compat_symbol (libc, __old_strncpy_by4, __strncpy_by4, GLIBC_2_1_1);
101compat_symbol (libc, __old_strncpy_by2, __strncpy_by2, GLIBC_2_1_1);
102
103char *
104__old_strncpy_gg (char *dest, const char *src, size_t n)
105{
106 return strncpy (dest, src, n);
107}
108compat_symbol (libc, __old_strncpy_gg, __strncpy_gg, GLIBC_2_1_1);
109
110/* __strcat_c took a third argument, which we ignore. */
111char *
112__old_strcat_g (char *dest, const char *src)
113{
114 return strcat (dest, src);
115}
116strong_alias (__old_strcat_g, __old_strcat_c);
117compat_symbol (libc, __old_strcat_g, __strcat_g, GLIBC_2_1_1);
118compat_symbol (libc, __old_strcat_c, __strcat_c, GLIBC_2_1_1);
119
120char *
121__old_strncat_g (char *dest, const char *src, size_t n)
122{
123 return __strncat (dest, src, n);
124}
125compat_symbol (libc, __old_strncat_g, __strncat_g, GLIBC_2_1_1);
126
127int
128__old_strcmp_gg (const char *s1, const char *s2)
129{
130 return strcmp (s1, s2);
131}
132compat_symbol (libc, __old_strcmp_gg, __strcmp_gg, GLIBC_2_1_1);
133
134int
135__old_strncmp_g (const char *s1, const char *s2, size_t n)
136{
137 return strncmp (s1, s2, n);
138}
139compat_symbol (libc, __old_strncmp_g, __strncmp_g, GLIBC_2_1_1);
140
141char *
142__old_strchr_g (const char *s, int c)
143{
144 return strchr (s, c);
145}
146strong_alias (__old_strchr_g, __old_strchr_c);
147compat_symbol (libc, __old_strchr_g, __strchr_g, GLIBC_2_1_1);
148compat_symbol (libc, __old_strchr_c, __strchr_c, GLIBC_2_1_1);
149
150char *
151__old_strchrnul_g (const char *s, int c)
152{
153 return __strchrnul (s, c);
154}
155strong_alias (__old_strchrnul_g, __old_strchrnul_c);
156compat_symbol (libc, __old_strchrnul_g, __strchrnul_g, GLIBC_2_1_1);
157compat_symbol (libc, __old_strchrnul_c, __strchrnul_c, GLIBC_2_1_1);
158
159char *
160__old_strrchr_g (const char *s, int c)
161{
162 return strrchr (s, c);
163}
164strong_alias (__old_strrchr_g, __old_strrchr_c);
165compat_symbol (libc, __old_strrchr_g, __strrchr_g, GLIBC_2_1_1);
166compat_symbol (libc, __old_strrchr_c, __strrchr_c, GLIBC_2_1_1);
167
168/* __strcspn_cg took a third argument, which we ignore. */
169size_t
170__old_strcspn_g (const char *s, const char *reject)
171{
172 return strcspn (s, reject);
173}
174strong_alias (__old_strcspn_g, __old_strcspn_cg);
175compat_symbol (libc, __old_strcspn_g, __strcspn_g, GLIBC_2_1_1);
176compat_symbol (libc, __old_strcspn_cg, __strcspn_cg, GLIBC_2_1_1);
177
178/* __strspn_cg took a third argument, which we ignore. */
179size_t
180__old_strspn_g (const char *s, const char *accept)
181{
182 return strspn (s, accept);
183}
184strong_alias (__old_strspn_g, __old_strspn_cg);
185compat_symbol (libc, __old_strspn_g, __strspn_g, GLIBC_2_1_1);
186compat_symbol (libc, __old_strspn_cg, __strspn_cg, GLIBC_2_1_1);
187
188/* __strpbrk_cg took a third argument, which we ignore. */
189const char *
190__old_strpbrk_g (const char *s, const char *accept)
191{
192 return strpbrk (s, accept);
193}
194strong_alias (__old_strpbrk_g, __old_strpbrk_cg);
195compat_symbol (libc, __old_strpbrk_g, __strpbrk_g, GLIBC_2_1_1);
196compat_symbol (libc, __old_strpbrk_cg, __strpbrk_cg, GLIBC_2_1_1);
197
198/* __strstr_cg took a third argument, which we ignore. */
199const char *
200__old_strstr_g (const char *s, const char *accept)
201{
202 return strstr (s, accept);
203}
204strong_alias (__old_strstr_g, __old_strstr_cg);
205compat_symbol (libc, __old_strstr_g, __strstr_g, GLIBC_2_1_1);
206compat_symbol (libc, __old_strstr_cg, __strstr_cg, GLIBC_2_1_1);
207
208#endif
209

source code of glibc/sysdeps/i386/string-inlines.c