diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-03-19 21:04:10 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-03-19 21:04:10 +0000 |
commit | 8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf (patch) | |
tree | b7091affa76bbaf47e78a59dfc72b2102554eaf9 /libio/bits | |
parent | f5c3480e830e94e0e51a0bdb1053944daed8bc58 (diff) | |
download | glibc-8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf.tar.gz glibc-8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf.tar.xz glibc-8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf.zip |
Updated to fedora-glibc-20050319T1907 cvs/fedora-glibc-2_3_4-15
Diffstat (limited to 'libio/bits')
-rw-r--r-- | libio/bits/stdio2.h | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h index 6ab6841c53..a462c1d8cf 100644 --- a/libio/bits/stdio2.h +++ b/libio/bits/stdio2.h @@ -83,22 +83,40 @@ extern int __vprintf_chk (int __flag, __const char *__restrict __format, #endif -extern char *__gets_chk (char *__str, size_t); -#define gets(__str) \ - ((__bos (__str) == (size_t) -1) \ - ? gets (__str) : __gets_chk (__str, __bos (__str))) - -extern void __chk_fail (void) __attribute__((noreturn)); -#define fgets(__str, __n, __fp) \ - (__extension__ \ - ({ size_t __n_val = (__n); \ - if (__bos (__str) != (size_t) -1 && __bos (__str) < __n_val) \ - __chk_fail (); \ - fgets (__str, __n_val, __fp); })) - -#define fgets_unlocked(__str, __n, __fp) \ - (__extension__ \ - ({ size_t __n_val = (__n); \ - if (__bos (__str) != (size_t) -1 && __bos (__str) < __n_val) \ - __chk_fail (); \ - fgets_unlocked (__str, __n_val, __fp); })) +extern char *__gets_chk (char *__str, size_t) __wur; +extern char *__REDIRECT (__gets_alias, (char *__str), gets) __wur; + +extern __always_inline __wur char * +gets (char *__str) +{ + if (__bos (__str) != (size_t) -1) + return __gets_chk (__str, __bos (__str)); + return __gets_alias (__str); +} + +extern void __chk_fail (void) __attribute__((__noreturn__)); +extern char *__REDIRECT (__fgets_alias, + (char *__restrict __s, int __n, + FILE *__restrict __stream), fgets) __wur; + +extern __always_inline __wur char * +fgets (char *__restrict __s, int __n, FILE *__restrict __stream) +{ + if (__bos (__s) != (size_t) -1 && (size_t) __n > __bos (__s)) + __chk_fail (); + return __fgets_alias (__s, __n, __stream); +} + +#ifdef __USE_GNU +extern char *__REDIRECT (__fgets_unlocked_alias, + (char *__restrict __s, int __n, + FILE *__restrict __stream), fgets_unlocked) __wur; + +extern __always_inline __wur char * +fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) +{ + if (__bos (__s) != (size_t) -1 && (size_t) __n > __bos (__s)) + __chk_fail (); + return __fgets_unlocked_alias (__s, __n, __stream); +} +#endif |