Back to index

glibc  2.9
wchar2.h
Go to the documentation of this file.
00001 /* Checking macros for wchar functions.
00002    Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _WCHAR_H
00021 # error "Never include <bits/wchar2.h> directly; use <wchar.h> instead."
00022 #endif
00023 
00024 
00025 extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1,
00026                             __const wchar_t *__restrict __s2, size_t __n,
00027                             size_t __ns1) __THROW;
00028 extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias,
00029                             (wchar_t *__restrict __s1,
00030                              __const wchar_t *__restrict __s2, size_t __n),
00031                             wmemcpy);
00032 extern wchar_t *__REDIRECT_NTH (__wmemcpy_chk_warn,
00033                             (wchar_t *__restrict __s1,
00034                              __const wchar_t *__restrict __s2, size_t __n,
00035                              size_t __ns1), __wmemcpy_chk)
00036      __warnattr ("wmemcpy called with length bigger than size of destination "
00037                "buffer");
00038 
00039 __extern_always_inline wchar_t *
00040 __NTH (wmemcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
00041               size_t __n))
00042 {
00043   if (__bos0 (__s1) != (size_t) -1)
00044     {
00045       if (!__builtin_constant_p (__n))
00046        return __wmemcpy_chk (__s1, __s2, __n,
00047                            __bos0 (__s1) / sizeof (wchar_t));
00048 
00049       if (__n > __bos0 (__s1) / sizeof (wchar_t))
00050        return __wmemcpy_chk_warn (__s1, __s2, __n,
00051                                __bos0 (__s1) / sizeof (wchar_t));
00052     }
00053   return __wmemcpy_alias (__s1, __s2, __n);
00054 }
00055 
00056 
00057 extern wchar_t *__wmemmove_chk (wchar_t *__s1, __const wchar_t *__s2,
00058                             size_t __n, size_t __ns1) __THROW;
00059 extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1,
00060                                              __const wchar_t *__s2,
00061                                              size_t __n), wmemmove);
00062 extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn,
00063                             (wchar_t *__restrict __s1,
00064                              __const wchar_t *__restrict __s2, size_t __n,
00065                              size_t __ns1), __wmemmove_chk)
00066      __warnattr ("wmemmove called with length bigger than size of destination "
00067                "buffer");
00068 
00069 __extern_always_inline wchar_t *
00070 __NTH (wmemmove (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
00071                size_t __n))
00072 {
00073   if (__bos0 (__s1) != (size_t) -1)
00074     {
00075       if (!__builtin_constant_p (__n))
00076        return __wmemmove_chk (__s1, __s2, __n,
00077                             __bos0 (__s1) / sizeof (wchar_t));
00078 
00079       if (__n > __bos0 (__s1) / sizeof (wchar_t))
00080        return __wmemmove_chk_warn (__s1, __s2, __n,
00081                                 __bos0 (__s1) / sizeof (wchar_t));
00082     }
00083   return __wmemmove_alias (__s1, __s2, __n);
00084 }
00085 
00086 
00087 #ifdef __USE_GNU
00088 extern wchar_t *__wmempcpy_chk (wchar_t *__restrict __s1,
00089                             __const wchar_t *__restrict __s2, size_t __n,
00090                             size_t __ns1) __THROW;
00091 extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias,
00092                             (wchar_t *__restrict __s1,
00093                              __const wchar_t *__restrict __s2,
00094                              size_t __n), wmempcpy);
00095 extern wchar_t *__REDIRECT_NTH (__wmempcpy_chk_warn,
00096                             (wchar_t *__restrict __s1,
00097                              __const wchar_t *__restrict __s2, size_t __n,
00098                              size_t __ns1), __wmempcpy_chk)
00099      __warnattr ("wmempcpy called with length bigger than size of destination "
00100                "buffer");
00101 
00102 __extern_always_inline wchar_t *
00103 __NTH (wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
00104                size_t __n))
00105 {
00106   if (__bos0 (__s1) != (size_t) -1)
00107     {
00108       if (!__builtin_constant_p (__n))
00109        return __wmempcpy_chk (__s1, __s2, __n,
00110                             __bos0 (__s1) / sizeof (wchar_t));
00111 
00112       if (__n > __bos0 (__s1) / sizeof (wchar_t))
00113        return __wmempcpy_chk_warn (__s1, __s2, __n,
00114                                 __bos0 (__s1) / sizeof (wchar_t));
00115     }
00116   return __wmempcpy_alias (__s1, __s2, __n);
00117 }
00118 #endif
00119 
00120 
00121 extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
00122                             size_t __ns) __THROW;
00123 extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c,
00124                                             size_t __n), wmemset);
00125 extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn,
00126                             (wchar_t *__s, wchar_t __c, size_t __n,
00127                              size_t __ns), __wmemset_chk)
00128      __warnattr ("wmemset called with length bigger than size of destination "
00129                "buffer");
00130 
00131 __extern_always_inline wchar_t *
00132 __NTH (wmemset (wchar_t *__restrict __s, wchar_t __c, size_t __n))
00133 {
00134   if (__bos0 (__s) != (size_t) -1)
00135     {
00136       if (!__builtin_constant_p (__n))
00137        return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t));
00138 
00139       if (__n > __bos0 (__s) / sizeof (wchar_t))
00140        return __wmemset_chk_warn (__s, __c, __n,
00141                                __bos0 (__s) / sizeof (wchar_t));
00142     }
00143   return __wmemset_alias (__s, __c, __n);
00144 }
00145 
00146 
00147 extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest,
00148                            __const wchar_t *__restrict __src,
00149                            size_t __n) __THROW;
00150 extern wchar_t *__REDIRECT_NTH (__wcscpy_alias,
00151                             (wchar_t *__restrict __dest,
00152                              __const wchar_t *__restrict __src), wcscpy);
00153 
00154 __extern_always_inline wchar_t *
00155 __NTH (wcscpy (wchar_t *__dest, __const wchar_t *__src))
00156 {
00157   if (__bos (__dest) != (size_t) -1)
00158     return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
00159   return __wcscpy_alias (__dest, __src);
00160 }
00161 
00162 
00163 extern wchar_t *__wcpcpy_chk (wchar_t *__dest, __const wchar_t *__src,
00164                            size_t __destlen) __THROW;
00165 extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, (wchar_t *__dest,
00166                                            __const wchar_t *__src),
00167                             wcpcpy);
00168 
00169 __extern_always_inline wchar_t *
00170 __NTH (wcpcpy (wchar_t *__dest, __const wchar_t *__src))
00171 {
00172   if (__bos (__dest) != (size_t) -1)
00173     return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
00174   return __wcpcpy_alias (__dest, __src);
00175 }
00176 
00177 
00178 extern wchar_t *__wcsncpy_chk (wchar_t *__restrict __dest,
00179                             __const wchar_t *__restrict __src, size_t __n,
00180                             size_t __destlen) __THROW;
00181 extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias,
00182                             (wchar_t *__restrict __dest,
00183                              __const wchar_t *__restrict __src,
00184                              size_t __n), wcsncpy);
00185 extern wchar_t *__REDIRECT_NTH (__wcsncpy_chk_warn,
00186                             (wchar_t *__restrict __dest,
00187                              __const wchar_t *__restrict __src,
00188                              size_t __n, size_t __destlen), __wcsncpy_chk)
00189      __warnattr ("wcsncpy called with length bigger than size of destination "
00190                "buffer");
00191 
00192 __extern_always_inline wchar_t *
00193 __NTH (wcsncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n))
00194 {
00195   if (__bos (__dest) != (size_t) -1)
00196     {
00197       if (!__builtin_constant_p (__n))
00198        return __wcsncpy_chk (__dest, __src, __n,
00199                            __bos (__dest) / sizeof (wchar_t));
00200       if (__n > __bos (__dest) / sizeof (wchar_t))
00201        return __wcsncpy_chk_warn (__dest, __src, __n,
00202                                __bos (__dest) / sizeof (wchar_t));
00203     }
00204   return __wcsncpy_alias (__dest, __src, __n);
00205 }
00206 
00207 
00208 extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest,
00209                             __const wchar_t *__restrict __src, size_t __n,
00210                             size_t __destlen) __THROW;
00211 extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias,
00212                             (wchar_t *__restrict __dest,
00213                              __const wchar_t *__restrict __src,
00214                              size_t __n), wcpncpy);
00215 extern wchar_t *__REDIRECT_NTH (__wcpncpy_chk_warn,
00216                             (wchar_t *__restrict __dest,
00217                              __const wchar_t *__restrict __src,
00218                              size_t __n, size_t __destlen), __wcpncpy_chk)
00219      __warnattr ("wcpncpy called with length bigger than size of destination "
00220                "buffer");
00221 
00222 __extern_always_inline wchar_t *
00223 __NTH (wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n))
00224 {
00225   if (__bos (__dest) != (size_t) -1)
00226     {
00227       if (!__builtin_constant_p (__n))
00228        return __wcpncpy_chk (__dest, __src, __n,
00229                            __bos (__dest) / sizeof (wchar_t));
00230       if (__n > __bos (__dest) / sizeof (wchar_t))
00231        return __wcpncpy_chk_warn (__dest, __src, __n,
00232                                __bos (__dest) / sizeof (wchar_t));
00233     }
00234   return __wcpncpy_alias (__dest, __src, __n);
00235 }
00236 
00237 
00238 extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest,
00239                            __const wchar_t *__restrict __src,
00240                            size_t __destlen) __THROW;
00241 extern wchar_t *__REDIRECT_NTH (__wcscat_alias,
00242                             (wchar_t *__restrict __dest,
00243                              __const wchar_t *__restrict __src), wcscat);
00244 
00245 __extern_always_inline wchar_t *
00246 __NTH (wcscat (wchar_t *__dest, __const wchar_t *__src))
00247 {
00248   if (__bos (__dest) != (size_t) -1)
00249     return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
00250   return __wcscat_alias (__dest, __src);
00251 }
00252 
00253 
00254 extern wchar_t *__wcsncat_chk (wchar_t *__restrict __dest,
00255                             __const wchar_t *__restrict __src,
00256                             size_t __n, size_t __destlen) __THROW;
00257 extern wchar_t *__REDIRECT_NTH (__wcsncat_alias,
00258                             (wchar_t *__restrict __dest,
00259                              __const wchar_t *__restrict __src,
00260                              size_t __n), wcsncat);
00261 
00262 __extern_always_inline wchar_t *
00263 __NTH (wcsncat (wchar_t *__dest, __const wchar_t *__src, size_t __n))
00264 {
00265   if (__bos (__dest) != (size_t) -1)
00266     return __wcsncat_chk (__dest, __src, __n,
00267                        __bos (__dest) / sizeof (wchar_t));
00268   return __wcsncat_alias (__dest, __src, __n);
00269 }
00270 
00271 
00272 extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
00273                         int __flag, size_t __s_len,
00274                         __const wchar_t *__restrict __format, ...)
00275      __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
00276 
00277 extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
00278                             (wchar_t *__restrict __s, size_t __n,
00279                              __const wchar_t *__restrict __fmt, ...),
00280                             swprintf);
00281 
00282 #ifdef __va_arg_pack
00283 __extern_always_inline int
00284 __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
00285                __const wchar_t *__restrict __fmt, ...))
00286 {
00287   if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
00288     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
00289                         __bos (__s) / sizeof (wchar_t),
00290                         __fmt, __va_arg_pack ());
00291   return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
00292 }
00293 #elif !defined __cplusplus
00294 /* XXX We might want to have support in gcc for swprintf.  */
00295 # define swprintf(s, n, ...) \
00296   (__bos (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1                      \
00297    ? __swprintf_chk (s, n, __USE_FORTIFY_LEVEL - 1,                         \
00298                    __bos (s) / sizeof (wchar_t), __VA_ARGS__)               \
00299    : swprintf (s, n, __VA_ARGS__))
00300 #endif
00301 
00302 extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
00303                          int __flag, size_t __s_len,
00304                          __const wchar_t *__restrict __format,
00305                          __gnuc_va_list __arg)
00306      __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
00307 
00308 extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
00309                             (wchar_t *__restrict __s, size_t __n,
00310                              __const wchar_t *__restrict __fmt,
00311                              __gnuc_va_list __ap), vswprintf);
00312 
00313 __extern_always_inline int
00314 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
00315                 __const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
00316 {
00317   if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
00318     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
00319                          __bos (__s) / sizeof (wchar_t), __fmt, __ap);
00320   return __vswprintf_alias (__s, __n, __fmt, __ap);
00321 }
00322 
00323 
00324 #if __USE_FORTIFY_LEVEL > 1
00325 
00326 extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
00327                         __const wchar_t *__restrict __format, ...);
00328 extern int __wprintf_chk (int __flag, __const wchar_t *__restrict __format,
00329                        ...);
00330 extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
00331                          __const wchar_t *__restrict __format,
00332                          __gnuc_va_list __ap);
00333 extern int __vwprintf_chk (int __flag, __const wchar_t *__restrict __format,
00334                         __gnuc_va_list __ap);
00335 
00336 # ifdef __va_arg_pack
00337 __extern_always_inline int
00338 wprintf (__const wchar_t *__restrict __fmt, ...)
00339 {
00340   return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
00341 }
00342 
00343 __extern_always_inline int
00344 fwprintf (__FILE *__restrict __stream, __const wchar_t *__restrict __fmt, ...)
00345 {
00346   return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
00347                       __va_arg_pack ());
00348 }
00349 # elif !defined __cplusplus
00350 #  define wprintf(...) \
00351   __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
00352 #  define fwprintf(stream, ...) \
00353   __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
00354 # endif
00355 
00356 __extern_always_inline int
00357 vwprintf (__const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
00358 {
00359   return __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap);
00360 }
00361 
00362 __extern_always_inline int
00363 vfwprintf (__FILE *__restrict __stream,
00364           __const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
00365 {
00366   return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
00367 }
00368 
00369 #endif
00370 
00371 extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n,
00372                            __FILE *__restrict __stream) __wur;
00373 extern wchar_t *__REDIRECT (__fgetws_alias,
00374                          (wchar_t *__restrict __s, int __n,
00375                           __FILE *__restrict __stream), fgetws) __wur;
00376 extern wchar_t *__REDIRECT (__fgetws_chk_warn,
00377                          (wchar_t *__restrict __s, size_t __size, int __n,
00378                           __FILE *__restrict __stream), __fgetws_chk)
00379      __wur __warnattr ("fgetws called with bigger size than length "
00380                      "of destination buffer");
00381 
00382 __extern_always_inline __wur wchar_t *
00383 fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
00384 {
00385   if (__bos (__s) != (size_t) -1)
00386     {
00387       if (!__builtin_constant_p (__n) || __n <= 0)
00388        return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t),
00389                           __n, __stream);
00390 
00391       if ((size_t) __n > __bos (__s) / sizeof (wchar_t))
00392        return __fgetws_chk_warn (__s, __bos (__s) / sizeof (wchar_t),
00393                               __n, __stream);
00394     }
00395   return __fgetws_alias (__s, __n, __stream);
00396 }
00397 
00398 #ifdef __USE_GNU
00399 extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size,
00400                                    int __n, __FILE *__restrict __stream)
00401   __wur;
00402 extern wchar_t *__REDIRECT (__fgetws_unlocked_alias,
00403                          (wchar_t *__restrict __s, int __n,
00404                           __FILE *__restrict __stream), fgetws_unlocked)
00405   __wur;
00406 extern wchar_t *__REDIRECT (__fgetws_unlocked_chk_warn,
00407                          (wchar_t *__restrict __s, size_t __size, int __n,
00408                           __FILE *__restrict __stream),
00409                          __fgetws_unlocked_chk)
00410      __wur __warnattr ("fgetws_unlocked called with bigger size than length "
00411                      "of destination buffer");
00412 
00413 __extern_always_inline __wur wchar_t *
00414 fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
00415 {
00416   if (__bos (__s) != (size_t) -1)
00417     {
00418       if (!__builtin_constant_p (__n) || __n <= 0)
00419        return __fgetws_unlocked_chk (__s, __bos (__s) / sizeof (wchar_t),
00420                                   __n, __stream);
00421 
00422       if ((size_t) __n > __bos (__s) / sizeof (wchar_t))
00423        return __fgetws_unlocked_chk_warn (__s, __bos (__s) / sizeof (wchar_t),
00424                                       __n, __stream);
00425     }
00426   return __fgetws_unlocked_alias (__s, __n, __stream);
00427 }
00428 #endif
00429 
00430 
00431 extern size_t __wcrtomb_chk (char *__s, wchar_t __wchar, mbstate_t *__p,
00432                        size_t __buflen) __THROW __wur;
00433 extern size_t __REDIRECT_NTH (__wcrtomb_alias,
00434                            (char *__restrict __s, wchar_t __wchar,
00435                             mbstate_t *__restrict __ps), wcrtomb) __wur;
00436 
00437 __extern_always_inline __wur size_t
00438 __NTH (wcrtomb (char *__s, wchar_t __wchar, mbstate_t *__ps))
00439 {
00440   /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
00441      But this would only disturb the namespace.  So we define our own
00442      version here.  */
00443 #define __WCHAR_MB_LEN_MAX  16
00444 #if defined MB_LEN_MAX && MB_LEN_MAX != __WCHAR_MB_LEN_MAX
00445 # error "Assumed value of MB_LEN_MAX wrong"
00446 #endif
00447   if (__bos (__s) != (size_t) -1 && __WCHAR_MB_LEN_MAX > __bos (__s))
00448     return __wcrtomb_chk (__s, __wchar, __ps, __bos (__s));
00449   return __wcrtomb_alias (__s, __wchar, __ps);
00450 }
00451 
00452 
00453 extern size_t __mbsrtowcs_chk (wchar_t *__restrict __dst,
00454                             __const char **__restrict __src,
00455                             size_t __len, mbstate_t *__restrict __ps,
00456                             size_t __dstlen) __THROW;
00457 extern size_t __REDIRECT_NTH (__mbsrtowcs_alias,
00458                            (wchar_t *__restrict __dst,
00459                             __const char **__restrict __src,
00460                             size_t __len, mbstate_t *__restrict __ps),
00461                            mbsrtowcs);
00462 extern size_t __REDIRECT_NTH (__mbsrtowcs_chk_warn,
00463                            (wchar_t *__restrict __dst,
00464                             __const char **__restrict __src,
00465                             size_t __len, mbstate_t *__restrict __ps,
00466                             size_t __dstlen), __mbsrtowcs_chk)
00467      __warnattr ("mbsrtowcs called with dst buffer smaller than len "
00468                "* sizeof (wchar_t)");
00469 
00470 __extern_always_inline size_t
00471 __NTH (mbsrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src,
00472                 size_t __len, mbstate_t *__restrict __ps))
00473 {
00474   if (__bos (__dst) != (size_t) -1)
00475     {
00476       if (!__builtin_constant_p (__len))
00477        return __mbsrtowcs_chk (__dst, __src, __len, __ps,
00478                             __bos (__dst) / sizeof (wchar_t));
00479 
00480       if (__len > __bos (__dst) / sizeof (wchar_t))
00481        return __mbsrtowcs_chk_warn (__dst, __src, __len, __ps,
00482                                  __bos (__dst) / sizeof (wchar_t));
00483     }
00484   return __mbsrtowcs_alias (__dst, __src, __len, __ps);
00485 }
00486 
00487 
00488 extern size_t __wcsrtombs_chk (char *__restrict __dst,
00489                             __const wchar_t **__restrict __src,
00490                             size_t __len, mbstate_t *__restrict __ps,
00491                             size_t __dstlen) __THROW;
00492 extern size_t __REDIRECT_NTH (__wcsrtombs_alias,
00493                            (char *__restrict __dst,
00494                             __const wchar_t **__restrict __src,
00495                             size_t __len, mbstate_t *__restrict __ps),
00496                            wcsrtombs);
00497 extern size_t __REDIRECT_NTH (__wcsrtombs_chk_warn,
00498                            (char *__restrict __dst,
00499                             __const wchar_t **__restrict __src,
00500                             size_t __len, mbstate_t *__restrict __ps,
00501                             size_t __dstlen), __wcsrtombs_chk)
00502     __warnattr ("wcsrtombs called with dst buffer smaller than len");
00503 
00504 __extern_always_inline size_t
00505 __NTH (wcsrtombs (char *__restrict __dst, __const wchar_t **__restrict __src,
00506                 size_t __len, mbstate_t *__restrict __ps))
00507 {
00508   if (__bos (__dst) != (size_t) -1)
00509     {
00510       if (!__builtin_constant_p (__len))
00511        return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst));
00512 
00513       if (__len > __bos (__dst))
00514        return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst));
00515     }
00516   return __wcsrtombs_alias (__dst, __src, __len, __ps);
00517 }
00518 
00519 
00520 #ifdef __USE_GNU
00521 extern size_t __mbsnrtowcs_chk (wchar_t *__restrict __dst,
00522                             __const char **__restrict __src, size_t __nmc,
00523                             size_t __len, mbstate_t *__restrict __ps,
00524                             size_t __dstlen) __THROW;
00525 extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias,
00526                            (wchar_t *__restrict __dst,
00527                             __const char **__restrict __src, size_t __nmc,
00528                             size_t __len, mbstate_t *__restrict __ps),
00529                            mbsnrtowcs);
00530 extern size_t __REDIRECT_NTH (__mbsnrtowcs_chk_warn,
00531                            (wchar_t *__restrict __dst,
00532                             __const char **__restrict __src, size_t __nmc,
00533                             size_t __len, mbstate_t *__restrict __ps,
00534                             size_t __dstlen), __mbsnrtowcs_chk)
00535      __warnattr ("mbsnrtowcs called with dst buffer smaller than len "
00536                "* sizeof (wchar_t)");
00537 
00538 __extern_always_inline size_t
00539 __NTH (mbsnrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src,
00540                  size_t __nmc, size_t __len, mbstate_t *__restrict __ps))
00541 {
00542   if (__bos (__dst) != (size_t) -1)
00543     {
00544       if (!__builtin_constant_p (__len))
00545        return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps,
00546                              __bos (__dst) / sizeof (wchar_t));
00547 
00548       if (__len > __bos (__dst) / sizeof (wchar_t))
00549        return __mbsnrtowcs_chk_warn (__dst, __src, __nmc, __len, __ps,
00550                                   __bos (__dst) / sizeof (wchar_t));
00551     }
00552   return __mbsnrtowcs_alias (__dst, __src, __nmc, __len, __ps);
00553 }
00554 
00555 
00556 extern size_t __wcsnrtombs_chk (char *__restrict __dst,
00557                             __const wchar_t **__restrict __src,
00558                             size_t __nwc, size_t __len,
00559                             mbstate_t *__restrict __ps, size_t __dstlen)
00560      __THROW;
00561 extern size_t __REDIRECT_NTH (__wcsnrtombs_alias,
00562                            (char *__restrict __dst,
00563                             __const wchar_t **__restrict __src,
00564                             size_t __nwc, size_t __len,
00565                             mbstate_t *__restrict __ps), wcsnrtombs);
00566 extern size_t __REDIRECT_NTH (__wcsnrtombs_chk_warn,
00567                            (char *__restrict __dst,
00568                             __const wchar_t **__restrict __src,
00569                             size_t __nwc, size_t __len,
00570                             mbstate_t *__restrict __ps,
00571                             size_t __dstlen), __wcsnrtombs_chk)
00572      __warnattr ("wcsnrtombs called with dst buffer smaller than len");
00573 
00574 __extern_always_inline size_t
00575 __NTH (wcsnrtombs (char *__restrict __dst, __const wchar_t **__restrict __src,
00576                  size_t __nwc, size_t __len, mbstate_t *__restrict __ps))
00577 {
00578   if (__bos (__dst) != (size_t) -1)
00579     {
00580       if (!__builtin_constant_p (__len))
00581        return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps,
00582                              __bos (__dst));
00583 
00584       if (__len > __bos (__dst))
00585        return __wcsnrtombs_chk_warn (__dst, __src, __nwc, __len, __ps,
00586                                   __bos (__dst));
00587     }
00588   return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps);
00589 }
00590 #endif