You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/10/25 13:52:56 UTC
svn commit: r328342 -
/webservices/axis2/trunk/c/modules/util/src/axis2_hash.c
Author: samisa
Date: Tue Oct 25 04:52:49 2005
New Revision: 328342
URL: http://svn.apache.org/viewcvs?rev=328342&view=rev
Log:
added hash_free function
Modified:
webservices/axis2/trunk/c/modules/util/src/axis2_hash.c
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_hash.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_hash.c?rev=328342&r1=328341&r2=328342&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_hash.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_hash.c Tue Oct 25 04:52:49 2005
@@ -496,3 +496,35 @@
}
return res;
}
+
+
+static void axis2_hash_entry_free(axis2_environment_t *environment,axis2_hash_entry_t *hash_entry)
+{
+ axis2_hash_entry_t *entry;
+ if(!hash_entry)
+ return;
+ if(hash_entry->next)
+ {
+ axis2_hash_entry_free(environment,hash_entry->next);
+ }
+ axis2_free(environment->allocator,hash_entry->key);
+ axis2_free(environment->allocator,hash_entry->val);
+ axis2_free(environment->allocator,hash_entry);
+ return;
+}
+
+axis2_status_t axis2_hash_free(axis2_environment_t *environment,axis2_hash_t *ht)
+{
+ int i=0;
+ if(ht)
+ {
+ while((ht->array[i]))
+ axis2_hash_entry_free(environment,(axis2_hash_entry_t*)(ht->array[i]));
+ if(ht->free)
+ axis2_hash_entry_free(environment,ht->free);
+ axis2_free(environment->allocator,ht);
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+