apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: apr/tables apr_tables.c
Date Sat, 06 Jul 2002 08:13:35 GMT
brianp      2002/07/06 01:13:35

  Modified:    tables   apr_tables.c
  Log:
  Additional speedup for apr_table_unset(): don't start doing the
  check for dst_elt!=NULL on each iteration until we've seen the
  first instance of the target key
  
  Revision  Changes    Path
  1.34      +11 -6     apr/tables/apr_tables.c
  
  Index: apr_tables.c
  ===================================================================
  RCS file: /home/cvs/apr/tables/apr_tables.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- apr_tables.c	5 Jul 2002 09:09:11 -0000	1.33
  +++ apr_tables.c	6 Jul 2002 08:13:35 -0000	1.34
  @@ -505,7 +505,7 @@
   {
       apr_table_entry_t *next_elt = (apr_table_entry_t *) t->a.elts;
       apr_table_entry_t *end_elt = next_elt + t->a.nelts;
  -    apr_table_entry_t *dst_elt = NULL;
  +    apr_table_entry_t *dst_elt;
       apr_uint32_t checksum;
   
       COMPUTE_KEY_CHECKSUM(key, checksum);
  @@ -513,12 +513,17 @@
   	if ((checksum == next_elt->key_checksum) &&
               !strcasecmp(next_elt->key, key)) {
               t->a.nelts--;
  -            if (!dst_elt) {
  -                dst_elt = next_elt;
  +            dst_elt = next_elt;
  +            for (next_elt++; next_elt < end_elt; next_elt++) {
  +                if ((checksum == next_elt->key_checksum) &&
  +                    !strcasecmp(next_elt->key, key)) {
  +                    t->a.nelts--;
  +                }
  +                else {
  +                    *dst_elt++ = *next_elt;
  +                }
               }
  -        }
  -        else if (dst_elt) {
  -            *dst_elt++ = *next_elt;
  +            break;
           }
       }
   }
  
  
  

Mime
View raw message