gstein 01/01/10 16:13:23
Modified: include apr_hash.h
tables apr_hash.c
Log:
add an accessor to the number of key/value pairs in the hash table.
Submitted by: Bill Tutt <[EMAIL PROTECTED]>
Reviewed by: Greg Stein
Revision Changes Path
1.18 +9 -0 apr/include/apr_hash.h
Index: apr_hash.h
===================================================================
RCS file: /home/cvs/apr/include/apr_hash.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -u -r1.17 -r1.18
--- apr_hash.h 2000/12/04 05:56:34 1.17
+++ apr_hash.h 2001/01/11 00:13:22 1.18
@@ -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
1.10 +5 -0 apr/tables/apr_hash.c
Index: apr_hash.c
===================================================================
RCS file: /home/cvs/apr/tables/apr_hash.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -u -r1.9 -r1.10
--- apr_hash.c 2000/11/08 00:54:23 1.9
+++ apr_hash.c 2001/01/11 00:13:23 1.10
@@ -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;
+}