about summary refs log tree commit diff
path: root/nscd/aicache.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-11-25 21:08:01 +0000
committerUlrich Drepper <drepper@redhat.com>2007-11-25 21:08:01 +0000
commit30294ea4495e48e0103fee4d855737a281cc49fa (patch)
tree23a6e4b71c9fb7758596f212085e0ce8eaf7e4b9 /nscd/aicache.c
parent609bb0712d522828bf52eb539d0b590ae153e55f (diff)
downloadglibc-30294ea4495e48e0103fee4d855737a281cc49fa.tar.gz
glibc-30294ea4495e48e0103fee4d855737a281cc49fa.tar.xz
glibc-30294ea4495e48e0103fee4d855737a281cc49fa.zip
* nscd/nscd.h (MAX_STACK_USE): Define.
	* nscd/mem.c (MAX_STACK_USE): Remove definition here.
	(gc): Initialize stack_used based on allocation in prune_cache.
	* nscd/cache.c (prune_cache): Use heap for mark array if necessary.
	Clear array bfore use.

	* nscd/aicache.c (addhstaiX): Update statistics counter in case
	memory allocate failed.
Diffstat (limited to 'nscd/aicache.c')
-rw-r--r--nscd/aicache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/nscd/aicache.c b/nscd/aicache.c
index 26968b2d4a..a69a7781d3 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -339,7 +339,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 			= (struct dataset *) mempool_alloc (db,
 							    total
 							    + req->key_len);
-		      if (newp != NULL)
+		      if (__builtin_expect (newp != NULL, 1))
 			{
 			  /* Adjust pointer into the memory block.  */
 			  key_copy = (char *) newp + (key_copy
@@ -349,6 +349,8 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 					    total + req->key_len);
 			  alloca_used = false;
 			}
+		      else
+			++db->head->addfailed;
 
 		      /* Mark the old record as obsolete.  */
 		      dh->usable = false;