Diff
Modified: freeswitch/trunk/libs/apr/.update (15541 => 15542)
--- freeswitch/trunk/libs/apr/.update 2009-11-19 14:20:53 UTC (rev 15541)
+++ freeswitch/trunk/libs/apr/.update 2009-11-19 14:24:59 UTC (rev 15542)
@@ -1 +1 @@
-Mon Jun 8 11:30:01 EDT 2009
+Thu Nov 19 09:24:37 EST 2009
Modified: freeswitch/trunk/libs/apr/include/apr_hash.h (15541 => 15542)
--- freeswitch/trunk/libs/apr/include/apr_hash.h 2009-11-19 14:20:53 UTC (rev 15541)
+++ freeswitch/trunk/libs/apr/include/apr_hash.h 2009-11-19 14:24:59 UTC (rev 15542)
@@ -175,6 +175,12 @@
APR_DECLARE(unsigned int) apr_hash_count(apr_hash_t *ht);
/**
+ * Clear any key/value pairs in the hash table.
+ * @param ht The hash table
+ */
+APR_DECLARE(void) apr_hash_clear(apr_hash_t *ht);
+
+/**
* Merge two hash tables into one new hash table. The values of the overlay
* hash override the values of the base if both have the same key. Both
* hash tables must use the same hash function.
Modified: freeswitch/trunk/libs/apr/include/apr_tables.h (15541 => 15542)
--- freeswitch/trunk/libs/apr/include/apr_tables.h 2009-11-19 14:20:53 UTC (rev 15541)
+++ freeswitch/trunk/libs/apr/include/apr_tables.h 2009-11-19 14:24:59 UTC (rev 15542)
@@ -120,6 +120,25 @@
*/
APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
+/** A helper macro for accessing a member of an APR array.
+ *
+ * @param ary the array
+ * @param i the index into the array to return
+ * @param type the type of the objects stored in the array
+ *
+ * @return the item at index i
+ */
+#define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
+
+/** A helper macro for pushing elements into an APR array.
+ *
+ * @param ary the array
+ * @param type the type of the objects stored in the array
+ *
+ * @return the location where the new object should be placed
+ */
+#define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
+
/**
* Remove an element from an array (as a first-in, last-out stack)
* @param arr The array to remove an element from.
@@ -129,6 +148,14 @@
APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr);
/**
+ * Remove all elements from an array.
+ * @param arr The array to remove all elements from.
+ * @remark As the underlying storage is allocated from a pool, no
+ * memory is freed by this operation, but is available for reuse.
+ */
+APR_DECLARE(void) apr_array_clear(apr_array_header_t *arr);
+
+/**
* Concatenate two arrays together
* @param dst The destination array, and the one to go first in the combined
* array
Modified: freeswitch/trunk/libs/apr/tables/apr_hash.c (15541 => 15542)
--- freeswitch/trunk/libs/apr/tables/apr_hash.c 2009-11-19 14:20:53 UTC (rev 15541)
+++ freeswitch/trunk/libs/apr/tables/apr_hash.c 2009-11-19 14:24:59 UTC (rev 15542)
@@ -367,6 +367,13 @@
return ht->count;
}
+APR_DECLARE(void) apr_hash_clear(apr_hash_t *ht)
+{
+ apr_hash_index_t *hi;
+ for (hi = apr_hash_first(NULL, ht); hi; hi = apr_hash_next(hi))
+ apr_hash_set(ht, hi->this->key, hi->this->klen, NULL);
+}
+
APR_DECLARE(apr_hash_t*) apr_hash_overlay(apr_pool_t *p,
const apr_hash_t *overlay,
const apr_hash_t *base)
Modified: freeswitch/trunk/libs/apr/tables/apr_tables.c (15541 => 15542)
--- freeswitch/trunk/libs/apr/tables/apr_tables.c 2009-11-19 14:20:53 UTC (rev 15541)
+++ freeswitch/trunk/libs/apr/tables/apr_tables.c 2009-11-19 14:24:59 UTC (rev 15542)
@@ -90,6 +90,11 @@
return res;
}
+APR_DECLARE(void) apr_array_clear(apr_array_header_t *arr)
+{
+ arr->nelts = 0;
+}
+
APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr)
{
if (apr_is_empty_array(arr)) {