]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
2005-02-21 Jakub Jelinek <jakub@redhat.com>
authorRoland McGrath <roland@gnu.org>
Sat, 26 Feb 2005 01:19:02 +0000 (01:19 +0000)
committerRoland McGrath <roland@gnu.org>
Sat, 26 Feb 2005 01:19:02 +0000 (01:19 +0000)
[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.

nscd/grpcache.c
nscd/hstcache.c
nscd/pwdcache.c

index c565f5a68278232252b079c19ffd901ee6dee61f..3cfad653e40093bec41a746592168bb8d2639375 100644 (file)
@@ -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
index 99d2998f49b9534f064fe6829ddc064a3dabce60..754f7a6615700e84b23cbe421c24c7df1fe848b7 100644 (file)
@@ -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
index e8b9578778dbf06bc3d2cd473ec366fd953aa22d..49fc71491cc42796c79bb387bccae4f5ae9b76e8 100644 (file)
@@ -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