httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/tables apr_hash.c
Date Mon, 16 Oct 2000 12:32:43 GMT
gstein      00/10/16 05:32:43

  Modified:    src/lib/apr/include apr_hash.h
               src/lib/apr/tables apr_hash.c
  Log:
  Make sure that passing (s, APR_HASH_KEY_STRING) and (s, strlen(s)) are
  equivalent. The +1 would lead to subtle errors when people forgot t
  include the null-term in the hash value. (and it is possible that the
  caller is extracting a substring for the key and does not *have* a null
  term when doing a lookup)
  
  Revision  Changes    Path
  1.14      +4 -2      apache-2.0/src/lib/apr/include/apr_hash.h
  
  Index: apr_hash.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_hash.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- apr_hash.h	2000/10/16 06:04:43	1.13
  +++ apr_hash.h	2000/10/16 12:32:42	1.14
  @@ -74,8 +74,10 @@
    * passed to indicate a string-valued key, and have apr_hash compute the
    * length automatically.
    *
  - * Note: apr_hash will use strlen(key)+1 for the length. This allows
  - *   apr_hash_this() to return a null-terminated string as the key.
  + * Note: apr_hash will use strlen(key) for the length. The null-terminator
  + *       is not included in the hash value (why throw a constant in?).
  + *       Since the hash table merely references the provided key (rather
  + *       than copying it), apr_hash_this() will return the null-term'd key.
    */
   #define APR_HASH_KEY_STRING     (-1)
   
  
  
  
  1.7       +1 -1      apache-2.0/src/lib/apr/tables/apr_hash.c
  
  Index: apr_hash.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/tables/apr_hash.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- apr_hash.c	2000/10/16 06:04:49	1.6
  +++ apr_hash.c	2000/10/16 12:32:42	1.7
  @@ -216,7 +216,7 @@
       int i;
   
       if (klen == APR_HASH_KEY_STRING)
  -	klen = strlen(key) + 1;
  +	klen = strlen(key);
   
       /*
        * This is Daniel J. Bernstein's popular `times 33' hash function
  
  
  

Mime
View raw message