about summary refs log tree commit diff
path: root/nscd/grpcache.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-03-22 07:17:03 +0000
committerUlrich Drepper <drepper@redhat.com>2002-03-22 07:17:03 +0000
commitc7a9b6e2d3f2257ecd6fe1da6f4c0dfdd5521b29 (patch)
tree7a74261571efa5ceb373a4368c09e0339d7e3232 /nscd/grpcache.c
parent0472723ab8f686b0a64d3d37690a044a73e2ad94 (diff)
downloadglibc-c7a9b6e2d3f2257ecd6fe1da6f4c0dfdd5521b29.tar.gz
glibc-c7a9b6e2d3f2257ecd6fe1da6f4c0dfdd5521b29.tar.xz
glibc-c7a9b6e2d3f2257ecd6fe1da6f4c0dfdd5521b29.zip
Update.
2002-03-21  Ulrich Drepper  <drepper@redhat.com>

	* nscd/grpcache.c (addgrbyname): Improve buffer allocate with alloca.
	Use realloc if too large.
	(addgrbyid): Likewise.
	* nscd/hstcache.c (addhstbyname): Likewise.
	(addhstbyaddr): Likewise.
	(addhstbynamev6): Likewise.
	(addhstbyaddrv6): Likewise.
	* nscd/pwdcache.c (addpwbyname): Likewise.
	(addpwbyuid): Likewise.
Diffstat (limited to 'nscd/grpcache.c')
-rw-r--r--nscd/grpcache.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index a7895ad486..ce84668900 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -207,14 +207,14 @@ addgrbyname (struct database *db, int fd, request_header *req,
      simply insert it.  It does not matter if it is in there twice.  The
      pruning function only will look at the timestamp.  */
   int buflen = 1024;
-  char *buffer = alloca (buflen);
+  char *buffer = (char *) alloca (buflen);
   struct group resultbuf;
   struct group *grp;
   uid_t oldeuid = 0;
   bool use_malloc = false;
 
-  if (debug_level > 0)
-    dbg_log (_("Haven't found \"%s\" in group cache!"), (char *)key);
+  if (__builtin_expect (debug_level > 0, 0))
+    dbg_log (_("Haven't found \"%s\" in group cache!"), (char *) key);
 
   if (secure[grpdb])
     {
@@ -245,7 +245,7 @@ addgrbyname (struct database *db, int fd, request_header *req,
 	}
       else
 	{
-	  buffer = alloca (buflen);
+	  buffer = (char *) alloca (buflen);
 #if _STACK_GROWS_DOWN
 	  if (buffer + buflen == old_buffer)
 	    buflen = 2 * buflen - 1024;
@@ -278,7 +278,7 @@ addgrbygid (struct database *db, int fd, request_header *req,
      simply insert it.  It does not matter if it is in there twice.  The
      pruning function only will look at the timestamp.  */
   int buflen = 1024;
-  char *buffer = alloca (buflen);
+  char *buffer = (char *) alloca (buflen);
   struct group resultbuf;
   struct group *grp;
   uid_t oldeuid = 0;
@@ -286,16 +286,16 @@ addgrbygid (struct database *db, int fd, request_header *req,
   gid_t gid = strtoul ((char *)key, &ep, 10);
   bool use_malloc = false;
 
-  if (*(char*)key == '\0' || *ep != '\0')  /* invalid numeric gid */
+  if (*(char *) key == '\0' || *ep != '\0')  /* invalid numeric gid */
     {
       if (debug_level > 0)
-        dbg_log (_("Invalid numeric gid \"%s\"!"), (char *)key);
+        dbg_log (_("Invalid numeric gid \"%s\"!"), (char *) key);
 
       errno = EINVAL;
       return;
     }
 
-  if (debug_level > 0)
+  if (__builtin_expect (debug_level > 0, 0))
     dbg_log (_("Haven't found \"%d\" in group cache!"), gid);
 
   if (secure[grpdb])
@@ -327,7 +327,7 @@ addgrbygid (struct database *db, int fd, request_header *req,
 	}
       else
 	{
-	  buffer = alloca (buflen);
+	  buffer = (char *) alloca (buflen);
 #if _STACK_GROWS_DOWN
 	  if (buffer + buflen == old_buffer)
 	    buflen = 2 * buflen - 1024;