You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by je...@apache.org on 2001/09/06 08:34:59 UTC

cvs commit: apr/tables apr_hash.c

jerenkrantz    01/09/05 23:34:59

  Modified:    tables   apr_hash.c
  Log:
  The find_entry() function in apr_hash.c is responsible for over
  half the apr_pcalloc() calls in the httpd.  The calloc call
  is somewhat wasteful in this context; 4 of the 5 fields in the
  allocated struct get overwritten immediately.  Thus the following
  patch replaces the calloc with an alloc and sets the one necessary
  field to NULL.
  Submitted by:	Brian Pane <bp...@pacbell.net>
  Reviewed by:	Justin Erenkrantz
  
  Revision  Changes    Path
  1.25      +2 -1      apr/tables/apr_hash.c
  
  Index: apr_hash.c
  ===================================================================
  RCS file: /home/cvs/apr/tables/apr_hash.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- apr_hash.c	2001/08/02 03:18:44	1.24
  +++ apr_hash.c	2001/09/06 06:34:59	1.25
  @@ -278,7 +278,8 @@
       if (he || !val)
   	return hep;
       /* add a new entry for non-NULL values */
  -    he = apr_pcalloc(ht->pool, sizeof(*he));
  +    he = apr_palloc(ht->pool, sizeof(*he));
  +    he->next = NULL;
       he->hash = hash;
       he->key  = key;
       he->klen = klen;