mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
More optimizations of nss_files
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
2011-08-20 Ulrich Drepper <drepper@gmail.com>
|
2011-08-20 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
* nss/nss_files/files-alias.c (get_next_alias): Use feof_unlocked.
|
* nss/nss_files/files-alias.c (get_next_alias): Use feof_unlocked
|
||||||
|
and fgetc_unlocked.
|
||||||
|
* nss/nss_files/files-key.c (search): Use fgets_unlocked and
|
||||||
|
getc_unlocked.
|
||||||
|
|
||||||
* elf/dl-open.c (add_to_global): Report additions to the global scope
|
* elf/dl-open.c (add_to_global): Report additions to the global scope
|
||||||
for LD_DEBUG=scopes.
|
for LD_DEBUG=scopes.
|
||||||
|
@@ -335,7 +335,7 @@ get_next_alias (const char *match, struct aliasent *result,
|
|||||||
just read character. */
|
just read character. */
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
ch = fgetc (stream);
|
ch = fgetc_unlocked (stream);
|
||||||
if (ch == EOF || ch == '\n' || !isspace (ch))
|
if (ch == EOF || ch == '\n' || !isspace (ch))
|
||||||
{
|
{
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* Public key file parser in nss_files module.
|
/* Public key file parser in nss_files module.
|
||||||
Copyright (C) 1996, 1997, 1998, 2006 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 1998, 2006, 2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@@ -33,9 +33,7 @@ extern int xdecrypt (char *, char *);
|
|||||||
static enum nss_status
|
static enum nss_status
|
||||||
search (const char *netname, char *result, int *errnop, int secret)
|
search (const char *netname, char *result, int *errnop, int secret)
|
||||||
{
|
{
|
||||||
FILE *stream;
|
FILE *stream = fopen (DATAFILE, "re");
|
||||||
|
|
||||||
stream = fopen (DATAFILE, "r");
|
|
||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
return errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
|
return errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
|
||||||
|
|
||||||
@@ -46,7 +44,7 @@ search (const char *netname, char *result, int *errnop, int secret)
|
|||||||
char *save_ptr;
|
char *save_ptr;
|
||||||
|
|
||||||
buffer[sizeof (buffer) - 1] = '\xff';
|
buffer[sizeof (buffer) - 1] = '\xff';
|
||||||
p = fgets (buffer, sizeof (buffer), stream);
|
p = fgets_unlocked (buffer, sizeof (buffer), stream);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
{
|
{
|
||||||
/* End of file or read error. */
|
/* End of file or read error. */
|
||||||
@@ -58,7 +56,7 @@ search (const char *netname, char *result, int *errnop, int secret)
|
|||||||
{
|
{
|
||||||
/* Invalid line in file? Skip remainder of line. */
|
/* Invalid line in file? Skip remainder of line. */
|
||||||
if (buffer[sizeof (buffer) - 2] != '\0')
|
if (buffer[sizeof (buffer) - 2] != '\0')
|
||||||
while (getc (stream) != '\n')
|
while (getc_unlocked (stream) != '\n')
|
||||||
continue;
|
continue;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user