You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Bill Tutt <bi...@microsoft.com> on 2001/01/10 09:58:16 UTC

APR patch: No function to return # of keys...

Believe it or not...

Index: include/apr_hash.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_hash.h,v
retrieving revision 1.17
diff -u -r1.17 apr_hash.h
--- include/apr_hash.h	2000/12/04 05:56:34	1.17
+++ include/apr_hash.h	2001/01/10 09:54:58
@@ -173,6 +173,15 @@
 APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, const void **key, 
                                apr_size_t *klen, void **val);
 
+/**
+ * Get the number of keys in the hash table.
+ * @param ht The hash table
+ * @param count Return pointer for the number of keys
+ * @deffunc void apr_hash_count(apr_hash_t *ht, apr_size_t *count);
+ */
+APR_DECLARE(void) apr_hash_count(apr_hash_t *ht, apr_size_t *count);
+
+
 #ifdef __cplusplus
 }
 #endif
Index: tables/apr_hash.c
===================================================================
RCS file: /home/cvspublic/apr/tables/apr_hash.c,v
retrieving revision 1.9
diff -u -r1.9 apr_hash.c
--- tables/apr_hash.c	2000/11/08 00:54:23	1.9
+++ tables/apr_hash.c	2001/01/10 09:54:58
@@ -314,3 +314,8 @@
     }
     /* else key not present and val==NULL */
 }
+
+APR_DECLARE(void) apr_hash_count(apr_hash_t *ht, apr_size_t *count)
+{
+	*count = ht->count;
+}
Index: libapr.def
===================================================================
RCS file: /home/cvspublic/apr/libapr.def,v
retrieving revision 1.57
diff -u -r1.57 libapr.def
--- libapr.def	2000/12/21 01:04:41	1.57
+++ libapr.def	2001/01/10 09:54:59
@@ -246,6 +246,7 @@
 	apr_hash_first
 	apr_hash_next
 	apr_hash_this
+	apr_hash_count
 ;
 ; apr_lock.h
 	apr_create_lock

If someone could take care of this that'd be great.

Thanks,
Bill

Re: APR patch: No function to return # of keys...

Posted by Greg Stein <gs...@lyra.org>.
APR patches should go to dev@apr.apache.org.

I've applied this patch just now.

Cheers,
-g

On Wed, Jan 10, 2001 at 01:58:16AM -0800, Bill Tutt wrote:
> Believe it or not...
> 
> Index: include/apr_hash.h
> ===================================================================
> RCS file: /home/cvspublic/apr/include/apr_hash.h,v
> retrieving revision 1.17
> diff -u -r1.17 apr_hash.h
> --- include/apr_hash.h	2000/12/04 05:56:34	1.17
> +++ include/apr_hash.h	2001/01/10 09:54:58
> @@ -173,6 +173,15 @@
>  APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, const void **key, 
>                                 apr_size_t *klen, void **val);
>  
> +/**
> + * Get the number of keys in the hash table.
> + * @param ht The hash table
> + * @param count Return pointer for the number of keys
> + * @deffunc void apr_hash_count(apr_hash_t *ht, apr_size_t *count);
> + */
> +APR_DECLARE(void) apr_hash_count(apr_hash_t *ht, apr_size_t *count);
> +
> +
>  #ifdef __cplusplus
>  }
>  #endif
> Index: tables/apr_hash.c
> ===================================================================
> RCS file: /home/cvspublic/apr/tables/apr_hash.c,v
> retrieving revision 1.9
> diff -u -r1.9 apr_hash.c
> --- tables/apr_hash.c	2000/11/08 00:54:23	1.9
> +++ tables/apr_hash.c	2001/01/10 09:54:58
> @@ -314,3 +314,8 @@
>      }
>      /* else key not present and val==NULL */
>  }
> +
> +APR_DECLARE(void) apr_hash_count(apr_hash_t *ht, apr_size_t *count)
> +{
> +	*count = ht->count;
> +}
> Index: libapr.def
> ===================================================================
> RCS file: /home/cvspublic/apr/libapr.def,v
> retrieving revision 1.57
> diff -u -r1.57 libapr.def
> --- libapr.def	2000/12/21 01:04:41	1.57
> +++ libapr.def	2001/01/10 09:54:59
> @@ -246,6 +246,7 @@
>  	apr_hash_first
>  	apr_hash_next
>  	apr_hash_this
> +	apr_hash_count
>  ;
>  ; apr_lock.h
>  	apr_create_lock
> 
> If someone could take care of this that'd be great.
> 
> Thanks,
> Bill

-- 
Greg Stein, http://www.lyra.org/

Re: APR patch: No function to return # of keys...

Posted by Branko Čibej <br...@xbc.nu>.
Bill Tutt wrote:

> +/**
> + * Get the number of keys in the hash table.
> + * @param ht The hash table
> + * @param count Return pointer for the number of keys
> + * @deffunc void apr_hash_count(apr_hash_t *ht, apr_size_t *count);
> + */
> +APR_DECLARE(void) apr_hash_count(apr_hash_t *ht, apr_size_t *count);

Just curious: Why use an output parameter, instead of the return value? 
Shouldn't the prototype be

    apr_size_t apr_hash_count(apr_hash_t *ht)
?

-- 
Brane �ibej
    home:   <br...@xbc.nu>             http://www.xbc.nu/brane/
    work:   <br...@hermes.si>   http://www.hermes-softlab.com/
     ACM:   <br...@acm.org>            http://www.acm.org/