Author: samisa
Date: Wed Nov 2 19:17:37 2005
New Revision: 330426
URL: http://svn.apache.org/viewcvs?rev=330426&view=rev
Log:
changed to take axis2_env_t* parameter as a double pointer to axis2_env_t
Modified:
webservices/axis2/trunk/c/modules/util/src/axis2_hash.c
webservices/axis2/trunk/c/modules/util/src/axis2_hash.h
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=330426&r1=330425&r2=330426&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_hash.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_hash.c Wed Nov 2 19:17:37
2005
@@ -87,11 +87,11 @@
}
AXIS2_DECLARE(axis2_hash_t*)
-axis2_hash_make (axis2_env_t *environment)
+axis2_hash_make (axis2_env_t **environment)
{
axis2_hash_t *ht;
- ht = AXIS2_MALLOC (environment->allocator, sizeof (axis2_hash_t));
- ht->environment = environment;
+ ht = AXIS2_MALLOC ((*environment)->allocator, sizeof (axis2_hash_t));
+ ht->environment = (*environment);
ht->free = NULL;
ht->count = 0;
ht->max = INITIAL_MAX;
@@ -101,7 +101,7 @@
}
AXIS2_DECLARE(axis2_hash_t*)
-axis2_hash_make_custom (axis2_env_t * environment,
+axis2_hash_make_custom (axis2_env_t **environment,
axis2_hashfunc_t hash_func)
{
axis2_hash_t *ht = axis2_hash_make (environment);
@@ -115,14 +115,14 @@
*/
AXIS2_DECLARE(axis2_hash_index_t*)
-axis2_hash_next (axis2_env_t *environment, axis2_hash_index_t *hi)
+axis2_hash_next (axis2_env_t **environment, axis2_hash_index_t *hi)
{
hi->this = hi->next;
while (!hi->this)
{
if (hi->index > hi->ht->max)
{
- AXIS2_FREE (environment->allocator, hi);
+ AXIS2_FREE ((*environment)->allocator, hi);
return NULL;
}
@@ -133,11 +133,11 @@
}
AXIS2_DECLARE(axis2_hash_index_t*)
-axis2_hash_first (axis2_hash_t *ht, axis2_env_t *environment)
+axis2_hash_first (axis2_hash_t *ht, axis2_env_t **environment)
{
axis2_hash_index_t *hi;
- if (environment)
- hi = AXIS2_MALLOC (environment->allocator, sizeof (*hi));
+ if (environment && *environment)
+ hi = AXIS2_MALLOC ((*environment)->allocator, sizeof (*hi));
else
hi = &ht->iterator;
@@ -296,16 +296,16 @@
}
AXIS2_DECLARE(axis2_hash_t*)
-axis2_hash_copy (const axis2_hash_t *orig, axis2_env_t *environment)
+axis2_hash_copy (const axis2_hash_t *orig, axis2_env_t **environment)
{
axis2_hash_t *ht;
axis2_hash_entry_t *new_vals;
unsigned int i, j;
- ht = AXIS2_MALLOC (environment->allocator, sizeof (axis2_hash_t) +
+ ht = AXIS2_MALLOC ((*environment)->allocator, sizeof (axis2_hash_t) +
sizeof (*ht->array) * (orig->max + 1) +
sizeof (axis2_hash_entry_t) * orig->count);
- ht->environment = environment;
+ ht->environment = (*environment);
ht->free = NULL;
ht->count = orig->count;
ht->max = orig->max;
@@ -383,14 +383,14 @@
}
AXIS2_DECLARE(axis2_hash_t*)
-axis2_hash_overlay (const axis2_hash_t *overlay, axis2_env_t *environment
+axis2_hash_overlay (const axis2_hash_t *overlay, axis2_env_t **environment
, const axis2_hash_t * base)
{
return axis2_hash_merge (overlay, environment, base, NULL, NULL);
}
AXIS2_DECLARE(axis2_hash_t*)
-axis2_hash_merge (const axis2_hash_t *overlay, axis2_env_t * environment
+axis2_hash_merge (const axis2_hash_t *overlay, axis2_env_t **environment
, const axis2_hash_t * base, void *(*merger)
(axis2_env_t * environment
, const void *key, axis2_ssize_t klen, const void *h1_val
, const void *h2_val, const void *data), const void *data)
@@ -420,8 +420,8 @@
}
#endif
- res = AXIS2_MALLOC (environment->allocator, sizeof (axis2_hash_t));
- res->environment = environment;
+ res = AXIS2_MALLOC ((*environment)->allocator, sizeof (axis2_hash_t));
+ res->environment = *environment;
res->free = NULL;
res->hash_func = base->hash_func;
res->count = base->count;
@@ -434,7 +434,7 @@
if (base->count + overlay->count)
{
new_vals =
- AXIS2_MALLOC (environment->allocator,
+ AXIS2_MALLOC ((*environment)->allocator,
sizeof (axis2_hash_entry_t) * (base->count +
overlay->count));
}
@@ -467,7 +467,7 @@
if (merger)
{
ent->val =
- (*merger) (environment, iter->key, iter->klen,
+ (*merger) ((*environment), iter->key, iter->klen,
iter->val, ent->val, data);
}
else
@@ -494,7 +494,7 @@
}
static void
-axis2_hash_entry_free (axis2_env_t *environment, axis2_hash_entry_t
*hash_entry)
+axis2_hash_entry_free (axis2_env_t **environment, axis2_hash_entry_t
*hash_entry)
{
printf ("hash entry called ");
if (!hash_entry)
@@ -506,19 +506,19 @@
/* axis2_free(environment->allocator,hash_entry->key);
axis2_free(environment->allocator,hash_entry->val);
*/
- AXIS2_FREE (environment->allocator, hash_entry);
+ AXIS2_FREE ((*environment)->allocator, hash_entry);
return;
}
AXIS2_DECLARE(axis2_status_t)
-axis2_hash_free (axis2_hash_t *ht, axis2_env_t* environment)
+axis2_hash_free (axis2_hash_t *ht, axis2_env_t** environment)
{
if (ht)
{
if (ht->free)
axis2_hash_entry_free (environment, ht->free);
- AXIS2_FREE(environment->allocator, ht->array);
- AXIS2_FREE (environment->allocator, ht);
+ AXIS2_FREE((*environment)->allocator, ht->array);
+ AXIS2_FREE ((*environment)->allocator, ht);
return AXIS2_SUCCESS;
}
return AXIS2_FAILURE;
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_hash.h
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_hash.h?rev=330426&r1=330425&r2=330426&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_hash.h (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_hash.h Wed Nov 2 19:17:37
2005
@@ -76,7 +76,7 @@
* @param environment The environment to allocate the hash table out of
* @return The hash table just created
*/
- AXIS2_DECLARE(axis2_hash_t*) axis2_hash_make (axis2_env_t *environment);
+ AXIS2_DECLARE(axis2_hash_t*) axis2_hash_make (axis2_env_t **environment);
/**
* Create a hash table with a custom hash function
@@ -84,7 +84,7 @@
* @param hash_func A custom hash function.
* @return The hash table just created
*/
- AXIS2_DECLARE(axis2_hash_t*) axis2_hash_make_custom (axis2_env_t
*environment
+ AXIS2_DECLARE(axis2_hash_t*) axis2_hash_make_custom (axis2_env_t
**environment
, axis2_hashfunc_t hash_func);
/**
@@ -95,7 +95,7 @@
* @remark Makes a shallow copy
*/
AXIS2_DECLARE(axis2_hash_t*) axis2_hash_copy (const axis2_hash_t *ht
- , axis2_env_t *environment);
+ , axis2_env_t **environment);
/**
* Associate a value with a key in a hash table.
@@ -147,7 +147,7 @@
* </PRE>
*/
AXIS2_DECLARE(axis2_hash_index_t*) axis2_hash_first (axis2_hash_t *ht
- ,axis2_env_t *environment);
+ ,axis2_env_t **environment);
/**
* Continue iterating over the entries in a hash table.
@@ -155,7 +155,7 @@
* @return a pointer to the updated iteration state. NULL if there are no
more
* entries.
*/
- AXIS2_DECLARE(axis2_hash_index_t*) axis2_hash_next (axis2_env_t *environment
+ AXIS2_DECLARE(axis2_hash_index_t*) axis2_hash_next (axis2_env_t **environment
, axis2_hash_index_t *hi);
/**
@@ -187,7 +187,7 @@
* @return A new hash table containing all of the data from the two passed in
*/
AXIS2_DECLARE(axis2_hash_t*) axis2_hash_overlay (const axis2_hash_t *overlay
- ,axis2_env_t *environment, const axis2_hash_t *base);
+ ,axis2_env_t **environment, const axis2_hash_t *base);
/**
* Merge two hash tables into one new hash table. If the same key
@@ -204,7 +204,7 @@
* @return A new hash table containing all of the data from the two passed in
*/
AXIS2_DECLARE(axis2_hash_t*) axis2_hash_merge (const axis2_hash_t *h1
- , axis2_env_t *environment, const axis2_hash_t *h2
+ , axis2_env_t **environment, const axis2_hash_t *h2
, void *(*merger) (axis2_env_t *environment, const void *key
, axis2_ssize_t klen, const void *h1_val, const void *h2_val
, const void *data), const void *data);
@@ -218,7 +218,7 @@
*/
AXIS2_DECLARE(axis2_status_t) axis2_hash_free(axis2_hash_t *ht
- , axis2_env_t *environment);
+ , axis2_env_t **environment);