diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-07-17 08:32:35 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-07-17 08:32:35 +0000 |
commit | 2706ee382341eb1c2e5f96c7d90f346696dbd0d8 (patch) | |
tree | c29690519bcb43604d9e0affa936aa7a2798660a /intl | |
parent | 23700036397721389b90ac41571d68df2f26ad67 (diff) | |
download | glibc-2706ee382341eb1c2e5f96c7d90f346696dbd0d8.tar.gz |
Update.
2001-07-17 Ulrich Drepper <drepper@redhat.com>
* inet/rcmd.c (iruserfopen): Disable implicit locking for the stream.
* inet/ruserpass.c (ruserpass): Likewise.
* nss/nsswitch.c (nss_parse_file): Likewise.
* resolv/res_hconf.c (_res_hconf_init): Likewise.
* resolv/res_init.c (__res_vinit): Likewise.
* gmon/bb_exit_func.c (__bb_exit_func): Likewise.
* misc/getpass.c (getpass): Likewise.
* misc/getusershell.c (initshells): Likewise.
* misc/getttyent.c (setttyent): Likewise.
* misc/mntent_r.c (__setmntent): Likewise.
* time/getdate.c (__getdate_r): Likewise.
* time/tzfile.c (__tzfile_read): Likewise.
* iconv/gconv_conf.c (read_conf_file): Likewise.
* intl/localealias.c (read_alias_file): Disable implicit locking
for the stream. Use _unlocked functions for glibc.
* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Disable
implicit locking for the stream.
(__get_nprocs_conf): Likewise.
(phys_pages_info): Likewise.
Diffstat (limited to 'intl')
-rw-r--r-- | intl/localealias.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/intl/localealias.c b/intl/localealias.c index 381264ba03..122b5807f9 100644 --- a/intl/localealias.c +++ b/intl/localealias.c @@ -30,6 +30,9 @@ #include <ctype.h> #include <stdio.h> +#if defined _LIBC || defined HAVE___FSETLOCKING +# include <stdio_ext.h> +#endif #include <sys/types.h> #ifdef __GNUC__ @@ -88,6 +91,7 @@ void free (); # define mempcpy __mempcpy # endif # define HAVE_MEMPCPY 1 +# define HAVE___FSETLOCKING 1 /* We need locking here since we can be called from different places. */ # include <bits/libc-lock.h> @@ -99,6 +103,15 @@ __libc_lock_define_initialized (static, lock); # define internal_function #endif +/* Some optimizations for glibc. */ +#ifdef _LIBC +# define FEOF(fp) feof_unlocked (fp) +# define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp) +#else +# define FEOF(fp) feof (fp) +# define FGETS(buf, n, fp) fgets (buf, n, fp) +#endif + /* For those losing systems which don't have `alloca' we have to add some additional code emulating it. */ #ifdef HAVE_ALLOCA @@ -228,8 +241,13 @@ read_alias_file (fname, fname_len) if (fp == NULL) return 0; +#ifdef HAVE___FSETLOCKING + /* No threads present. */ + __fsetlocking (fp, FSETLOCKING_BYCALLER); +#endif + added = 0; - while (!feof (fp)) + while (!FEOF (fp)) { /* It is a reasonable approach to use a fix buffer here because a) we are only interested in the first two fields @@ -241,7 +259,7 @@ read_alias_file (fname, fname_len) char *value; char *cp; - if (fgets (buf, sizeof buf, fp) == NULL) + if (FGETS (buf, sizeof buf, fp) == NULL) /* EOF reached. */ break; @@ -251,7 +269,7 @@ read_alias_file (fname, fname_len) { char altbuf[BUFSIZ]; do - if (fgets (altbuf, sizeof altbuf, fp) == NULL) + if (FGETS (altbuf, sizeof altbuf, fp) == NULL) /* Make sure the inner loop will be left. The outer loop will exit at the `feof' test. */ break; |