1 /* Checking macros for stdlib functions.
2 Copyright (C) 2005 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 # error "Never include <bits/stdlib.h> directly; use <stdlib.h> instead."
24 extern char *__realpath_chk (__const
char *__restrict __name
,
25 char *__restrict __resolved
,
26 size_t __resolvedlen
) __THROW __wur
;
27 extern char *__REDIRECT_NTH (__realpath_alias
,
28 (__const
char *__restrict __name
,
29 char *__restrict __resolved
), realpath
) __wur
;
31 extern __always_inline __wur
char *
32 realpath (const char *__name
, char *__resolved
)
34 if (__bos (__resolved
) != (size_t) -1)
35 return __realpath_chk (__name
, __resolved
, __bos (__resolved
));
37 return __realpath_alias (__name
, __resolved
);
41 extern int __ptsname_r_chk (int __fd
, char *__buf
, size_t __buflen
,
42 size_t __nreal
) __THROW
__nonnull ((2));
43 extern int __REDIRECT_NTH (__ptsname_r_alias
, (int __fd
, char *__buf
,
44 size_t __buflen
), ptsname_r
)
47 extern __always_inline
int
48 ptsname_r (int __fd
, char *__buf
, size_t __buflen
)
50 if (__bos (__buf
) != (size_t) -1
51 && (!__builtin_constant_p (__buflen
) || __buflen
> __bos (__buf
)))
52 return __ptsname_r_chk (__fd
, __buf
, __buflen
, __bos (__buf
));
53 return __ptsname_r_alias (__fd
, __buf
, __buflen
);
57 extern int __wctomb_chk (char *__s
, wchar_t __wchar
, size_t __buflen
)
59 extern int __REDIRECT_NTH (__wctomb_alias
, (char *__s
, wchar_t __wchar
),
62 extern __always_inline __wur
int
63 wctomb (char *__s
, wchar_t __wchar
)
65 /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
66 But this would only disturb the namespace. So we define our own
68 #define __STDLIB_MB_LEN_MAX 16
69 #if defined MB_LEN_MAX && MB_LEN_MAX != __STDLIB_MB_LEN_MAX
70 # error "Assumed value of MB_LEN_MAX wrong"
72 if (__bos (__s
) != (size_t) -1 && __STDLIB_MB_LEN_MAX
> __bos (__s
))
73 return __wctomb_chk (__s
, __wchar
, __bos (__s
));
74 return __wctomb_alias (__s
, __wchar
);