1 /* Checking macros for wchar functions.
2 Copyright (C) 2005-2016 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
20 # error "Never include <bits/wchar2.h> directly; use <wchar.h> instead."
24 extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1
,
25 const wchar_t *__restrict __s2
, size_t __n
,
26 size_t __ns1
) __THROW
;
27 extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias
,
28 (wchar_t *__restrict __s1
,
29 const wchar_t *__restrict __s2
, size_t __n
),
31 extern wchar_t *__REDIRECT_NTH (__wmemcpy_chk_warn
,
32 (wchar_t *__restrict __s1
,
33 const wchar_t *__restrict __s2
, size_t __n
,
34 size_t __ns1
), __wmemcpy_chk
)
35 __warnattr ("wmemcpy called with length bigger than size of destination "
38 __fortify_function
wchar_t *
39 __NTH (wmemcpy (wchar_t *__restrict __s1
, const wchar_t *__restrict __s2
,
42 if (__bos0 (__s1
) != (size_t) -1)
44 if (!__builtin_constant_p (__n
))
45 return __wmemcpy_chk (__s1
, __s2
, __n
,
46 __bos0 (__s1
) / sizeof (wchar_t));
48 if (__n
> __bos0 (__s1
) / sizeof (wchar_t))
49 return __wmemcpy_chk_warn (__s1
, __s2
, __n
,
50 __bos0 (__s1
) / sizeof (wchar_t));
52 return __wmemcpy_alias (__s1
, __s2
, __n
);
56 extern wchar_t *__wmemmove_chk (wchar_t *__s1
, const wchar_t *__s2
,
57 size_t __n
, size_t __ns1
) __THROW
;
58 extern wchar_t *__REDIRECT_NTH (__wmemmove_alias
, (wchar_t *__s1
,
60 size_t __n
), wmemmove
);
61 extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn
,
62 (wchar_t *__s1
, const wchar_t *__s2
,
63 size_t __n
, size_t __ns1
), __wmemmove_chk
)
64 __warnattr ("wmemmove called with length bigger than size of destination "
67 __fortify_function
wchar_t *
68 __NTH (wmemmove (wchar_t *__s1
, const wchar_t *__s2
, size_t __n
))
70 if (__bos0 (__s1
) != (size_t) -1)
72 if (!__builtin_constant_p (__n
))
73 return __wmemmove_chk (__s1
, __s2
, __n
,
74 __bos0 (__s1
) / sizeof (wchar_t));
76 if (__n
> __bos0 (__s1
) / sizeof (wchar_t))
77 return __wmemmove_chk_warn (__s1
, __s2
, __n
,
78 __bos0 (__s1
) / sizeof (wchar_t));
80 return __wmemmove_alias (__s1
, __s2
, __n
);
85 extern wchar_t *__wmempcpy_chk (wchar_t *__restrict __s1
,
86 const wchar_t *__restrict __s2
, size_t __n
,
87 size_t __ns1
) __THROW
;
88 extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias
,
89 (wchar_t *__restrict __s1
,
90 const wchar_t *__restrict __s2
,
91 size_t __n
), wmempcpy
);
92 extern wchar_t *__REDIRECT_NTH (__wmempcpy_chk_warn
,
93 (wchar_t *__restrict __s1
,
94 const wchar_t *__restrict __s2
, size_t __n
,
95 size_t __ns1
), __wmempcpy_chk
)
96 __warnattr ("wmempcpy called with length bigger than size of destination "
99 __fortify_function
wchar_t *
100 __NTH (wmempcpy (wchar_t *__restrict __s1
, const wchar_t *__restrict __s2
,
103 if (__bos0 (__s1
) != (size_t) -1)
105 if (!__builtin_constant_p (__n
))
106 return __wmempcpy_chk (__s1
, __s2
, __n
,
107 __bos0 (__s1
) / sizeof (wchar_t));
109 if (__n
> __bos0 (__s1
) / sizeof (wchar_t))
110 return __wmempcpy_chk_warn (__s1
, __s2
, __n
,
111 __bos0 (__s1
) / sizeof (wchar_t));
113 return __wmempcpy_alias (__s1
, __s2
, __n
);
118 extern wchar_t *__wmemset_chk (wchar_t *__s
, wchar_t __c
, size_t __n
,
119 size_t __ns
) __THROW
;
120 extern wchar_t *__REDIRECT_NTH (__wmemset_alias
, (wchar_t *__s
, wchar_t __c
,
121 size_t __n
), wmemset
);
122 extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn
,
123 (wchar_t *__s
, wchar_t __c
, size_t __n
,
124 size_t __ns
), __wmemset_chk
)
125 __warnattr ("wmemset called with length bigger than size of destination "
128 __fortify_function
wchar_t *
129 __NTH (wmemset (wchar_t *__s
, wchar_t __c
, size_t __n
))
131 if (__bos0 (__s
) != (size_t) -1)
133 if (!__builtin_constant_p (__n
))
134 return __wmemset_chk (__s
, __c
, __n
, __bos0 (__s
) / sizeof (wchar_t));
136 if (__n
> __bos0 (__s
) / sizeof (wchar_t))
137 return __wmemset_chk_warn (__s
, __c
, __n
,
138 __bos0 (__s
) / sizeof (wchar_t));
140 return __wmemset_alias (__s
, __c
, __n
);
144 extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest
,
145 const wchar_t *__restrict __src
,
147 extern wchar_t *__REDIRECT_NTH (__wcscpy_alias
,
148 (wchar_t *__restrict __dest
,
149 const wchar_t *__restrict __src
), wcscpy
);
151 __fortify_function
wchar_t *
152 __NTH (wcscpy (wchar_t *__restrict __dest
, const wchar_t *__restrict __src
))
154 if (__bos (__dest
) != (size_t) -1)
155 return __wcscpy_chk (__dest
, __src
, __bos (__dest
) / sizeof (wchar_t));
156 return __wcscpy_alias (__dest
, __src
);
160 extern wchar_t *__wcpcpy_chk (wchar_t *__restrict __dest
,
161 const wchar_t *__restrict __src
,
162 size_t __destlen
) __THROW
;
163 extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias
,
164 (wchar_t *__restrict __dest
,
165 const wchar_t *__restrict __src
), wcpcpy
);
167 __fortify_function
wchar_t *
168 __NTH (wcpcpy (wchar_t *__restrict __dest
, const wchar_t *__restrict __src
))
170 if (__bos (__dest
) != (size_t) -1)
171 return __wcpcpy_chk (__dest
, __src
, __bos (__dest
) / sizeof (wchar_t));
172 return __wcpcpy_alias (__dest
, __src
);
176 extern wchar_t *__wcsncpy_chk (wchar_t *__restrict __dest
,
177 const wchar_t *__restrict __src
, size_t __n
,
178 size_t __destlen
) __THROW
;
179 extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias
,
180 (wchar_t *__restrict __dest
,
181 const wchar_t *__restrict __src
,
182 size_t __n
), wcsncpy
);
183 extern wchar_t *__REDIRECT_NTH (__wcsncpy_chk_warn
,
184 (wchar_t *__restrict __dest
,
185 const wchar_t *__restrict __src
,
186 size_t __n
, size_t __destlen
), __wcsncpy_chk
)
187 __warnattr ("wcsncpy called with length bigger than size of destination "
190 __fortify_function
wchar_t *
191 __NTH (wcsncpy (wchar_t *__restrict __dest
, const wchar_t *__restrict __src
,
194 if (__bos (__dest
) != (size_t) -1)
196 if (!__builtin_constant_p (__n
))
197 return __wcsncpy_chk (__dest
, __src
, __n
,
198 __bos (__dest
) / sizeof (wchar_t));
199 if (__n
> __bos (__dest
) / sizeof (wchar_t))
200 return __wcsncpy_chk_warn (__dest
, __src
, __n
,
201 __bos (__dest
) / sizeof (wchar_t));
203 return __wcsncpy_alias (__dest
, __src
, __n
);
207 extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest
,
208 const wchar_t *__restrict __src
, size_t __n
,
209 size_t __destlen
) __THROW
;
210 extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias
,
211 (wchar_t *__restrict __dest
,
212 const wchar_t *__restrict __src
,
213 size_t __n
), wcpncpy
);
214 extern wchar_t *__REDIRECT_NTH (__wcpncpy_chk_warn
,
215 (wchar_t *__restrict __dest
,
216 const wchar_t *__restrict __src
,
217 size_t __n
, size_t __destlen
), __wcpncpy_chk
)
218 __warnattr ("wcpncpy called with length bigger than size of destination "
221 __fortify_function
wchar_t *
222 __NTH (wcpncpy (wchar_t *__restrict __dest
, const wchar_t *__restrict __src
,
225 if (__bos (__dest
) != (size_t) -1)
227 if (!__builtin_constant_p (__n
))
228 return __wcpncpy_chk (__dest
, __src
, __n
,
229 __bos (__dest
) / sizeof (wchar_t));
230 if (__n
> __bos (__dest
) / sizeof (wchar_t))
231 return __wcpncpy_chk_warn (__dest
, __src
, __n
,
232 __bos (__dest
) / sizeof (wchar_t));
234 return __wcpncpy_alias (__dest
, __src
, __n
);
238 extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest
,
239 const wchar_t *__restrict __src
,
240 size_t __destlen
) __THROW
;
241 extern wchar_t *__REDIRECT_NTH (__wcscat_alias
,
242 (wchar_t *__restrict __dest
,
243 const wchar_t *__restrict __src
), wcscat
);
245 __fortify_function
wchar_t *
246 __NTH (wcscat (wchar_t *__restrict __dest
, const wchar_t *__restrict __src
))
248 if (__bos (__dest
) != (size_t) -1)
249 return __wcscat_chk (__dest
, __src
, __bos (__dest
) / sizeof (wchar_t));
250 return __wcscat_alias (__dest
, __src
);
254 extern wchar_t *__wcsncat_chk (wchar_t *__restrict __dest
,
255 const wchar_t *__restrict __src
,
256 size_t __n
, size_t __destlen
) __THROW
;
257 extern wchar_t *__REDIRECT_NTH (__wcsncat_alias
,
258 (wchar_t *__restrict __dest
,
259 const wchar_t *__restrict __src
,
260 size_t __n
), wcsncat
);
262 __fortify_function
wchar_t *
263 __NTH (wcsncat (wchar_t *__restrict __dest
, const wchar_t *__restrict __src
,
266 if (__bos (__dest
) != (size_t) -1)
267 return __wcsncat_chk (__dest
, __src
, __n
,
268 __bos (__dest
) / sizeof (wchar_t));
269 return __wcsncat_alias (__dest
, __src
, __n
);
273 extern int __swprintf_chk (wchar_t *__restrict __s
, size_t __n
,
274 int __flag
, size_t __s_len
,
275 const wchar_t *__restrict __format
, ...)
276 __THROW
/* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
278 extern int __REDIRECT_NTH_LDBL (__swprintf_alias
,
279 (wchar_t *__restrict __s
, size_t __n
,
280 const wchar_t *__restrict __fmt
, ...),
284 __fortify_function
int
285 __NTH (swprintf (wchar_t *__restrict __s
, size_t __n
,
286 const wchar_t *__restrict __fmt
, ...))
288 if (__bos (__s
) != (size_t) -1 || __USE_FORTIFY_LEVEL
> 1)
289 return __swprintf_chk (__s
, __n
, __USE_FORTIFY_LEVEL
- 1,
290 __bos (__s
) / sizeof (wchar_t),
291 __fmt
, __va_arg_pack ());
292 return __swprintf_alias (__s
, __n
, __fmt
, __va_arg_pack ());
294 #elif !defined __cplusplus
295 /* XXX We might want to have support in gcc for swprintf. */
296 # define swprintf(s, n, ...) \
297 (__bos (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1 \
298 ? __swprintf_chk (s, n, __USE_FORTIFY_LEVEL - 1, \
299 __bos (s) / sizeof (wchar_t), __VA_ARGS__) \
300 : swprintf (s, n, __VA_ARGS__))
303 extern int __vswprintf_chk (wchar_t *__restrict __s
, size_t __n
,
304 int __flag
, size_t __s_len
,
305 const wchar_t *__restrict __format
,
306 __gnuc_va_list __arg
)
307 __THROW
/* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
309 extern int __REDIRECT_NTH_LDBL (__vswprintf_alias
,
310 (wchar_t *__restrict __s
, size_t __n
,
311 const wchar_t *__restrict __fmt
,
312 __gnuc_va_list __ap
), vswprintf
);
314 __fortify_function
int
315 __NTH (vswprintf (wchar_t *__restrict __s
, size_t __n
,
316 const wchar_t *__restrict __fmt
, __gnuc_va_list __ap
))
318 if (__bos (__s
) != (size_t) -1 || __USE_FORTIFY_LEVEL
> 1)
319 return __vswprintf_chk (__s
, __n
, __USE_FORTIFY_LEVEL
- 1,
320 __bos (__s
) / sizeof (wchar_t), __fmt
, __ap
);
321 return __vswprintf_alias (__s
, __n
, __fmt
, __ap
);
325 #if __USE_FORTIFY_LEVEL > 1
327 extern int __fwprintf_chk (__FILE
*__restrict __stream
, int __flag
,
328 const wchar_t *__restrict __format
, ...);
329 extern int __wprintf_chk (int __flag
, const wchar_t *__restrict __format
,
331 extern int __vfwprintf_chk (__FILE
*__restrict __stream
, int __flag
,
332 const wchar_t *__restrict __format
,
333 __gnuc_va_list __ap
);
334 extern int __vwprintf_chk (int __flag
, const wchar_t *__restrict __format
,
335 __gnuc_va_list __ap
);
337 # ifdef __va_arg_pack
338 __fortify_function
int
339 wprintf (const wchar_t *__restrict __fmt
, ...)
341 return __wprintf_chk (__USE_FORTIFY_LEVEL
- 1, __fmt
, __va_arg_pack ());
344 __fortify_function
int
345 fwprintf (__FILE
*__restrict __stream
, const wchar_t *__restrict __fmt
, ...)
347 return __fwprintf_chk (__stream
, __USE_FORTIFY_LEVEL
- 1, __fmt
,
350 # elif !defined __cplusplus
351 # define wprintf(...) \
352 __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
353 # define fwprintf(stream, ...) \
354 __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
357 __fortify_function
int
358 vwprintf (const wchar_t *__restrict __fmt
, __gnuc_va_list __ap
)
360 return __vwprintf_chk (__USE_FORTIFY_LEVEL
- 1, __fmt
, __ap
);
363 __fortify_function
int
364 vfwprintf (__FILE
*__restrict __stream
,
365 const wchar_t *__restrict __fmt
, __gnuc_va_list __ap
)
367 return __vfwprintf_chk (__stream
, __USE_FORTIFY_LEVEL
- 1, __fmt
, __ap
);
372 extern wchar_t *__fgetws_chk (wchar_t *__restrict __s
, size_t __size
, int __n
,
373 __FILE
*__restrict __stream
) __wur
;
374 extern wchar_t *__REDIRECT (__fgetws_alias
,
375 (wchar_t *__restrict __s
, int __n
,
376 __FILE
*__restrict __stream
), fgetws
) __wur
;
377 extern wchar_t *__REDIRECT (__fgetws_chk_warn
,
378 (wchar_t *__restrict __s
, size_t __size
, int __n
,
379 __FILE
*__restrict __stream
), __fgetws_chk
)
380 __wur
__warnattr ("fgetws called with bigger size than length "
381 "of destination buffer");
383 __fortify_function __wur
wchar_t *
384 fgetws (wchar_t *__restrict __s
, int __n
, __FILE
*__restrict __stream
)
386 if (__bos (__s
) != (size_t) -1)
388 if (!__builtin_constant_p (__n
) || __n
<= 0)
389 return __fgetws_chk (__s
, __bos (__s
) / sizeof (wchar_t),
392 if ((size_t) __n
> __bos (__s
) / sizeof (wchar_t))
393 return __fgetws_chk_warn (__s
, __bos (__s
) / sizeof (wchar_t),
396 return __fgetws_alias (__s
, __n
, __stream
);
400 extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s
, size_t __size
,
401 int __n
, __FILE
*__restrict __stream
)
403 extern wchar_t *__REDIRECT (__fgetws_unlocked_alias
,
404 (wchar_t *__restrict __s
, int __n
,
405 __FILE
*__restrict __stream
), fgetws_unlocked
)
407 extern wchar_t *__REDIRECT (__fgetws_unlocked_chk_warn
,
408 (wchar_t *__restrict __s
, size_t __size
, int __n
,
409 __FILE
*__restrict __stream
),
410 __fgetws_unlocked_chk
)
411 __wur
__warnattr ("fgetws_unlocked called with bigger size than length "
412 "of destination buffer");
414 __fortify_function __wur
wchar_t *
415 fgetws_unlocked (wchar_t *__restrict __s
, int __n
, __FILE
*__restrict __stream
)
417 if (__bos (__s
) != (size_t) -1)
419 if (!__builtin_constant_p (__n
) || __n
<= 0)
420 return __fgetws_unlocked_chk (__s
, __bos (__s
) / sizeof (wchar_t),
423 if ((size_t) __n
> __bos (__s
) / sizeof (wchar_t))
424 return __fgetws_unlocked_chk_warn (__s
, __bos (__s
) / sizeof (wchar_t),
427 return __fgetws_unlocked_alias (__s
, __n
, __stream
);
432 extern size_t __wcrtomb_chk (char *__restrict __s
, wchar_t __wchar
,
433 mbstate_t *__restrict __p
,
434 size_t __buflen
) __THROW __wur
;
435 extern size_t __REDIRECT_NTH (__wcrtomb_alias
,
436 (char *__restrict __s
, wchar_t __wchar
,
437 mbstate_t *__restrict __ps
), wcrtomb
) __wur
;
439 __fortify_function __wur
size_t
440 __NTH (wcrtomb (char *__restrict __s
, wchar_t __wchar
,
441 mbstate_t *__restrict __ps
))
443 /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
444 But this would only disturb the namespace. So we define our own
446 #define __WCHAR_MB_LEN_MAX 16
447 #if defined MB_LEN_MAX && MB_LEN_MAX != __WCHAR_MB_LEN_MAX
448 # error "Assumed value of MB_LEN_MAX wrong"
450 if (__bos (__s
) != (size_t) -1 && __WCHAR_MB_LEN_MAX
> __bos (__s
))
451 return __wcrtomb_chk (__s
, __wchar
, __ps
, __bos (__s
));
452 return __wcrtomb_alias (__s
, __wchar
, __ps
);
456 extern size_t __mbsrtowcs_chk (wchar_t *__restrict __dst
,
457 const char **__restrict __src
,
458 size_t __len
, mbstate_t *__restrict __ps
,
459 size_t __dstlen
) __THROW
;
460 extern size_t __REDIRECT_NTH (__mbsrtowcs_alias
,
461 (wchar_t *__restrict __dst
,
462 const char **__restrict __src
,
463 size_t __len
, mbstate_t *__restrict __ps
),
465 extern size_t __REDIRECT_NTH (__mbsrtowcs_chk_warn
,
466 (wchar_t *__restrict __dst
,
467 const char **__restrict __src
,
468 size_t __len
, mbstate_t *__restrict __ps
,
469 size_t __dstlen
), __mbsrtowcs_chk
)
470 __warnattr ("mbsrtowcs called with dst buffer smaller than len "
471 "* sizeof (wchar_t)");
473 __fortify_function
size_t
474 __NTH (mbsrtowcs (wchar_t *__restrict __dst
, const char **__restrict __src
,
475 size_t __len
, mbstate_t *__restrict __ps
))
477 if (__bos (__dst
) != (size_t) -1)
479 if (!__builtin_constant_p (__len
))
480 return __mbsrtowcs_chk (__dst
, __src
, __len
, __ps
,
481 __bos (__dst
) / sizeof (wchar_t));
483 if (__len
> __bos (__dst
) / sizeof (wchar_t))
484 return __mbsrtowcs_chk_warn (__dst
, __src
, __len
, __ps
,
485 __bos (__dst
) / sizeof (wchar_t));
487 return __mbsrtowcs_alias (__dst
, __src
, __len
, __ps
);
491 extern size_t __wcsrtombs_chk (char *__restrict __dst
,
492 const wchar_t **__restrict __src
,
493 size_t __len
, mbstate_t *__restrict __ps
,
494 size_t __dstlen
) __THROW
;
495 extern size_t __REDIRECT_NTH (__wcsrtombs_alias
,
496 (char *__restrict __dst
,
497 const wchar_t **__restrict __src
,
498 size_t __len
, mbstate_t *__restrict __ps
),
500 extern size_t __REDIRECT_NTH (__wcsrtombs_chk_warn
,
501 (char *__restrict __dst
,
502 const wchar_t **__restrict __src
,
503 size_t __len
, mbstate_t *__restrict __ps
,
504 size_t __dstlen
), __wcsrtombs_chk
)
505 __warnattr ("wcsrtombs called with dst buffer smaller than len");
507 __fortify_function
size_t
508 __NTH (wcsrtombs (char *__restrict __dst
, const wchar_t **__restrict __src
,
509 size_t __len
, mbstate_t *__restrict __ps
))
511 if (__bos (__dst
) != (size_t) -1)
513 if (!__builtin_constant_p (__len
))
514 return __wcsrtombs_chk (__dst
, __src
, __len
, __ps
, __bos (__dst
));
516 if (__len
> __bos (__dst
))
517 return __wcsrtombs_chk_warn (__dst
, __src
, __len
, __ps
, __bos (__dst
));
519 return __wcsrtombs_alias (__dst
, __src
, __len
, __ps
);
524 extern size_t __mbsnrtowcs_chk (wchar_t *__restrict __dst
,
525 const char **__restrict __src
, size_t __nmc
,
526 size_t __len
, mbstate_t *__restrict __ps
,
527 size_t __dstlen
) __THROW
;
528 extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias
,
529 (wchar_t *__restrict __dst
,
530 const char **__restrict __src
, size_t __nmc
,
531 size_t __len
, mbstate_t *__restrict __ps
),
533 extern size_t __REDIRECT_NTH (__mbsnrtowcs_chk_warn
,
534 (wchar_t *__restrict __dst
,
535 const char **__restrict __src
, size_t __nmc
,
536 size_t __len
, mbstate_t *__restrict __ps
,
537 size_t __dstlen
), __mbsnrtowcs_chk
)
538 __warnattr ("mbsnrtowcs called with dst buffer smaller than len "
539 "* sizeof (wchar_t)");
541 __fortify_function
size_t
542 __NTH (mbsnrtowcs (wchar_t *__restrict __dst
, const char **__restrict __src
,
543 size_t __nmc
, size_t __len
, mbstate_t *__restrict __ps
))
545 if (__bos (__dst
) != (size_t) -1)
547 if (!__builtin_constant_p (__len
))
548 return __mbsnrtowcs_chk (__dst
, __src
, __nmc
, __len
, __ps
,
549 __bos (__dst
) / sizeof (wchar_t));
551 if (__len
> __bos (__dst
) / sizeof (wchar_t))
552 return __mbsnrtowcs_chk_warn (__dst
, __src
, __nmc
, __len
, __ps
,
553 __bos (__dst
) / sizeof (wchar_t));
555 return __mbsnrtowcs_alias (__dst
, __src
, __nmc
, __len
, __ps
);
559 extern size_t __wcsnrtombs_chk (char *__restrict __dst
,
560 const wchar_t **__restrict __src
,
561 size_t __nwc
, size_t __len
,
562 mbstate_t *__restrict __ps
, size_t __dstlen
)
564 extern size_t __REDIRECT_NTH (__wcsnrtombs_alias
,
565 (char *__restrict __dst
,
566 const wchar_t **__restrict __src
,
567 size_t __nwc
, size_t __len
,
568 mbstate_t *__restrict __ps
), wcsnrtombs
);
569 extern size_t __REDIRECT_NTH (__wcsnrtombs_chk_warn
,
570 (char *__restrict __dst
,
571 const wchar_t **__restrict __src
,
572 size_t __nwc
, size_t __len
,
573 mbstate_t *__restrict __ps
,
574 size_t __dstlen
), __wcsnrtombs_chk
)
575 __warnattr ("wcsnrtombs called with dst buffer smaller than len");
577 __fortify_function
size_t
578 __NTH (wcsnrtombs (char *__restrict __dst
, const wchar_t **__restrict __src
,
579 size_t __nwc
, size_t __len
, mbstate_t *__restrict __ps
))
581 if (__bos (__dst
) != (size_t) -1)
583 if (!__builtin_constant_p (__len
))
584 return __wcsnrtombs_chk (__dst
, __src
, __nwc
, __len
, __ps
,
587 if (__len
> __bos (__dst
))
588 return __wcsnrtombs_chk_warn (__dst
, __src
, __nwc
, __len
, __ps
,
591 return __wcsnrtombs_alias (__dst
, __src
, __nwc
, __len
, __ps
);