mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-12 14:21:18 +08:00
2005-02-21 Jakub Jelinek <jakub@redhat.com>
[BZ #768] * nscd/hstcache.c (INCR): Remove. (addhstbyX): Double buflen in each iteration rather than add INCR. * nscd/grpcache.c: Likewise. * nscd/pwdcache.c: Likewise.
This commit is contained in:
parent
719ad9f96f
commit
8995ebd0a7
@ -429,11 +429,10 @@ addgrbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
{
|
||||
char *old_buffer = buffer;
|
||||
errno = 0;
|
||||
#define INCR 1024
|
||||
|
||||
if (__builtin_expect (buflen > 32768, 0))
|
||||
{
|
||||
buflen += INCR;
|
||||
buflen *= 2;
|
||||
buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
@ -454,7 +453,7 @@ addgrbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
else
|
||||
/* Allocate a new buffer on the stack. If possible combine it
|
||||
with the previously allocated buffer. */
|
||||
buffer = (char *) extend_alloca (buffer, buflen, buflen + INCR);
|
||||
buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -453,11 +453,10 @@ addhstbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
{
|
||||
char *old_buffer = buffer;
|
||||
errno = 0;
|
||||
#define INCR 1024
|
||||
|
||||
if (__builtin_expect (buflen > 32768, 0))
|
||||
{
|
||||
buflen += INCR;
|
||||
buflen *= 2;
|
||||
buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
@ -478,7 +477,7 @@ addhstbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
else
|
||||
/* Allocate a new buffer on the stack. If possible combine it
|
||||
with the previously allocated buffer. */
|
||||
buffer = (char *) extend_alloca (buffer, buflen, buflen + INCR);
|
||||
buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -425,11 +425,10 @@ addpwbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
{
|
||||
char *old_buffer = buffer;
|
||||
errno = 0;
|
||||
#define INCR 1024
|
||||
|
||||
if (__builtin_expect (buflen > 32768, 0))
|
||||
{
|
||||
buflen += INCR;
|
||||
buflen *= 2;
|
||||
buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
@ -450,7 +449,7 @@ addpwbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
else
|
||||
/* Allocate a new buffer on the stack. If possible combine it
|
||||
with the previously allocated buffer. */
|
||||
buffer = (char *) extend_alloca (buffer, buflen, buflen + INCR);
|
||||
buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user