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/lib apr_hash.c
Date Mon, 10 Jul 2000 02:58:20 GMT
gstein      00/07/09 19:58:20

  Modified:    src/lib/apr/include apr_hash.h
               src/lib/apr/lib apr_hash.c
  Log:
  const-ify the hash table interfaces/implementation
  
  Revision  Changes    Path
  1.3       +9 -6      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_hash.h	2000/05/09 18:56:10	1.2
  +++ apr_hash.h	2000/07/10 02:58:19	1.3
  @@ -85,7 +85,8 @@
   
   /*
   
  -=head1 void ap_hash_set(ap_hash_t *ht, void *key, size_t klen, void *val)
  +=head1 void ap_hash_set(ap_hash_t *ht, const void *key, size_t klen,
  +                        const void *val)
   
   B<Associate a value with a key in a hash table.>
   
  @@ -99,11 +100,11 @@
   
   =cut
   */
  -void ap_hash_set(ap_hash_t *ht, void *key, size_t klen, void *val);
  +void ap_hash_set(ap_hash_t *ht, const void *key, size_t klen, const void *val);
   
   /*
   
  -=head1 void *ap_hash_get(ap_hash_t *ht, void *key, size_t klen)
  +=head1 void *ap_hash_get(ap_hash_t *ht, const void *key, size_t klen)
   
   B<Look up the value associated with a key in a hash table.>
   
  @@ -116,7 +117,7 @@
   
   =cut
   */
  -void *ap_hash_get(ap_hash_t *ht, void *key, size_t klen);
  +void *ap_hash_get(ap_hash_t *ht, const void *key, size_t klen);
   
   /*
   
  @@ -149,7 +150,8 @@
   
   /*
   
  -=head1 void ap_hash_this(ap_hash_index_t *hi, void **key, size_t *klen, void **val)
  +=head1 void ap_hash_this(ap_hash_index_t *hi, const void **key, size_t *klen,
  +                         void **val)
   
   B<Get the current entry's details from the iteration state.>
   
  @@ -163,7 +165,8 @@
   
   =cut
   */
  -void ap_hash_this(ap_hash_index_t *hi, void **key, size_t *klen, void **val);
  +void ap_hash_this(ap_hash_index_t *hi, const void **key, size_t *klen,
  +                  void **val);
   
   /*
   
  
  
  
  1.5       +12 -12    apache-2.0/src/lib/apr/lib/apr_hash.c
  
  Index: apr_hash.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_hash.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- apr_hash.c	2000/05/26 16:23:25	1.4
  +++ apr_hash.c	2000/07/10 02:58:20	1.5
  @@ -85,9 +85,9 @@
   struct ap_hash_entry_t {
       ap_hash_entry_t	*next;
       int			 hash;
  -    void		*key;
  +    const void		*key;
       size_t		 klen;
  -    void		*val;
  +    const void		*val;
   };
   
   /*
  @@ -167,13 +167,13 @@
   }
   
   APR_EXPORT(void) ap_hash_this(ap_hash_index_t *hi,
  -			      void  **key,
  +			      const void **key,
   			      size_t *klen,
  -			      void  **val)
  +			      void **val)
   {
       if (key)  *key  = hi->this->key;
       if (klen) *klen = hi->this->klen;
  -    if (val)  *val  = hi->this->val;
  +    if (val)  *val  = (void *)hi->this->val;
   }
   
   
  @@ -206,12 +206,12 @@
    */
   
   static ap_hash_entry_t **find_entry(ap_hash_t *ht,
  -				    void *key,
  +				    const void *key,
   				    size_t klen,
  -				    void *val)
  +				    const void *val)
   {
       ap_hash_entry_t **hep, *he;
  -    unsigned char *p;
  +    const unsigned char *p;
       int hash;
       int i;
   
  @@ -254,21 +254,21 @@
   }
   
   APR_EXPORT(void *) ap_hash_get(ap_hash_t *ht,
  -			       void *key,
  +			       const void *key,
   			       size_t klen)
   {
       ap_hash_entry_t *he;
       he = *find_entry(ht, key, klen, NULL);
       if (he)
  -	return he->val;
  +	return (void *)he->val;
       else
   	return NULL;
   }
   
   APR_EXPORT(void) ap_hash_set(ap_hash_t *ht,
  -			     void *key,
  +			     const void *key,
   			     size_t klen,
  -			     void *val)
  +			     const void *val)
   {
       ap_hash_entry_t **hep;
       hep = find_entry(ht, key, klen, val);
  
  
  

Mime
View raw message