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 da...@apache.org on 2005/11/02 12:04:20 UTC
svn commit: r330233 - in /webservices/axis2/trunk/c: include/
modules/test/util/ modules/util/src/ modules/util/test/
Author: damitha
Date: Wed Nov 2 03:04:00 2005
New Revision: 330233
URL: http://svn.apache.org/viewcvs?rev=330233&view=rev
Log:
in hash files interchanged env and hash structure
Modified:
webservices/axis2/trunk/c/include/axis2_environment.h
webservices/axis2/trunk/c/include/axis2_error.h
webservices/axis2/trunk/c/modules/test/util/Makefile.am
webservices/axis2/trunk/c/modules/test/util/Makefile.in
webservices/axis2/trunk/c/modules/test/util/test_util.c
webservices/axis2/trunk/c/modules/util/src/Makefile.am
webservices/axis2/trunk/c/modules/util/src/Makefile.in
webservices/axis2/trunk/c/modules/util/src/axis2_environment.c
webservices/axis2/trunk/c/modules/util/src/axis2_error.c
webservices/axis2/trunk/c/modules/util/src/axis2_hash.c
webservices/axis2/trunk/c/modules/util/src/axis2_hash.h
webservices/axis2/trunk/c/modules/util/test/util_hash_test.c
Modified: webservices/axis2/trunk/c/include/axis2_environment.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_environment.h?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_environment.h (original)
+++ webservices/axis2/trunk/c/include/axis2_environment.h Wed Nov 2 03:04:00 2005
@@ -64,8 +64,6 @@
/** Logging routines */
axis2_log_t *log;
- /** Status code */
- axis2_status_t status;
} axis2_env_t;
/**
@@ -93,6 +91,11 @@
* @return pointer to the newly created environment struct
*/
AXIS2_DECLARE(axis2_status_t) axis2_environment_free (axis2_env_t *env);
+
+ /**
+ *
+ */
+ AXIS2_DECLARE(axis2_status_t) axis2_environment_check_status (axis2_env_t *env);
/** @} */
Modified: webservices/axis2/trunk/c/include/axis2_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_error.h?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_error.h (original)
+++ webservices/axis2/trunk/c/include/axis2_error.h Wed Nov 2 03:04:00 2005
@@ -27,6 +27,8 @@
struct axis2_error;
struct axis2_error_ops;
+ typedef enum axis2_status_codes axis2_status_codes_t;
+ typedef enum axis2_error_codes axis2_error_codes_t;
/**
* @defgroup axis2_error Error
@@ -53,7 +55,17 @@
* get error message for the last error
* @return error message for the last error. NULL on error.
*/
- axis2_char_t * (AXIS2_CALL *get_message) (int error_number);
+ axis2_char_t * (AXIS2_CALL *get_message) (struct axis2_error *error
+ , axis2_error_codes_t error_number);
+
+ axis2_status_t (AXIS2_CALL *set_error_number) (struct axis2_error *error
+ , axis2_error_codes_t error_number);
+
+ axis2_status_t (AXIS2_CALL *set_status_code) (struct axis2_error *error
+ , axis2_status_codes_t status_code);
+
+ axis2_status_t (AXIS2_CALL *get_status_code) (struct axis2_error *error);
+
} axis2_error_ops_t;
/**
@@ -67,31 +79,43 @@
struct axis2_error_ops *ops;
/** last error number */
int error_number;
+
+ int status_code;
} axis2_error_t;
#define AXIS2_ERROR_FREE(error) ((error->ops)->free(error))
-#define AXIS2_ERROR_GET_MESSAGE(error) ((error)->ops->get_message())
+
+#define AXIS2_ERROR_GET_MESSAGE(error, status_code) ((error)->ops->get_message \
+ (error, status_code))
+
+#define AXIS2_ERROR_SET_ERROR_NUMBER(error, error_number) \
+ ((error)->ops->set_error_number(error, error_number))
+
+#define AXIS2_ERROR_SET_STATUS_CODE(error, status_code) \
+ ((error)->ops->set_status_code(error, status_code))
+
+#define AXIS2_ERROR_GET_STATUS_CODE(error) ((error)->ops->get_status_code(error))
/**
* \brief Axis2 status codes
*
* Possible status values for Axis2
*/
- typedef enum axis2_status_codes
+ enum axis2_status_codes
{
/** Failure state */
AXIS2_FAILURE = 0,
/** Success state */
AXIS2_SUCCESS
- } axis2_status_codes_t;
+ };
/**
* \brief Axis2 error codes
*
* Set of error codes for Axis2
*/
- typedef enum axis2_error_codes
+ enum axis2_error_codes
{
/** No error */
AXIS2_ERROR_NONE = 0,
@@ -122,8 +146,10 @@
/** Struct is not properly initialized */
AXIS2_ERROR_STRUCT_NOT_INITIALIZED,
/** Could not open the file */
- AXIS2_ERROR_COULD_NOT_OPEN_FILE
- } axis2_error_codes_t;
+ AXIS2_ERROR_COULD_NOT_OPEN_FILE,
+ /** Environment passed is null */
+ AXIS2_ERROR_ENVIRONMENT_IS_NULL
+ };
/** @} */
Modified: webservices/axis2/trunk/c/modules/test/util/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/util/Makefile.am?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/util/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/test/util/Makefile.am Wed Nov 2 03:04:00 2005
@@ -6,4 +6,5 @@
#test_util_LDADD = $(LDFLAGS) $(top_builddir)/modules/util/src/libaxis2_util.la
test_util_LDADD = $(LDFLAGS) -L$(top_builddir)/modules/util/src/.libs -laxis2_util
-INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include
+INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
+ -I$(top_builddir)/modules/util/src
Modified: webservices/axis2/trunk/c/modules/test/util/Makefile.in
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/util/Makefile.in?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/util/Makefile.in (original)
+++ webservices/axis2/trunk/c/modules/test/util/Makefile.in Wed Nov 2 03:04:00 2005
@@ -198,7 +198,9 @@
#test_util_LDADD = $(LDFLAGS) $(top_builddir)/modules/util/src/libaxis2_util.la
test_util_LDADD = $(LDFLAGS) -L$(top_builddir)/modules/util/src/.libs -laxis2_util
-INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include
+INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
+ -I$(top_builddir)/modules/util/src
+
all: all-recursive
.SUFFIXES:
Modified: webservices/axis2/trunk/c/modules/test/util/test_util.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/util/test_util.c?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/util/test_util.c (original)
+++ webservices/axis2/trunk/c/modules/test/util/test_util.c Wed Nov 2 03:04:00 2005
@@ -28,7 +28,7 @@
{
axis2_allocator_t *allocator = axis2_allocator_init (NULL);
axis2_env_t *env =
- axis2_environment_create (allocator, NULL, NULL, NULL, NULL);
+ axis2_environment_create (allocator, NULL, NULL, NULL);
return env;
}
@@ -45,16 +45,16 @@
char *key3 = "key3";
char *key4 = "key4";
- a1 = (a *) axis2_malloc(environment->allocator, sizeof (a));
- a2 = (a *) axis2_malloc(environment->allocator, sizeof (a));
- a3 = (a *) axis2_malloc(environment->allocator, sizeof (a));
- a4 = (a *) axis2_malloc(environment->allocator, sizeof (a));
+ a1 = (a *) AXIS2_MALLOC(environment->allocator, sizeof (a));
+ a2 = (a *) AXIS2_MALLOC(environment->allocator, sizeof (a));
+ a3 = (a *) AXIS2_MALLOC(environment->allocator, sizeof (a));
+ a4 = (a *) AXIS2_MALLOC(environment->allocator, sizeof (a));
- a1->value = axis2_strdup(environment->string, "value1");
- a2->value = axis2_strdup(environment->string, "value2");
- a3->value = axis2_strdup(environment->string, "value3");
- a4->value = axis2_strdup(environment->string, "value4");
+ a1->value = axis2_strdup("value1");
+ a2->value = axis2_strdup("value2");
+ a3->value = axis2_strdup("value3");
+ a4->value = axis2_strdup("value4");
ht = axis2_hash_make (environment);
@@ -92,14 +92,49 @@
*/
int test_file_diff(axis2_env_t *env)
{
- axis2_char_t *expected_file_name = axis2_strdup(env->string, "expected");
- axis2_char_t *actual_file_name = axis2_strdup(env->string, "actual");
+ axis2_char_t *expected_file_name = axis2_strdup("expected");
+ axis2_char_t *actual_file_name = axis2_strdup("actual");
axis2_file_diff(env, expected_file_name, actual_file_name);
+ return 0;
+}
+
+char* test_funct_for_test_env_null(axis2_env_t **env)
+{
+ if(NULL == *env)
+ {
+ axis2_allocator_t *allocator = axis2_allocator_init (NULL);
+ *env = axis2_environment_create (allocator, NULL, NULL, NULL);
+ AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_ENVIRONMENT_IS_NULL);
+ return NULL;
+ }
+ return "environment not null, so be happy";
+}
+
+int test_env_null()
+{
+ axis2_env_t *env;
+ /* Suppose we did properly initialized env here */
+ /* But here we mistakenly make env to null */
+ env = NULL;
+ /*Now we call an axis2 mock function called
+ * test_funct_for_test_env_null
+ */
+ char *msg = test_funct_for_test_env_null(&env);
+ int status = axis2_environment_check_status(env);
+ if(AXIS2_SUCCESS == status)
+ printf("%s\n", msg);
+ else
+ printf("status code is:%d\n", status);
+ return 0;
}
int main(void)
{
axis2_env_t *env = test_init();
test_file_diff(env);
- test_hash_get(env);
+ test_hash_get(env);
+ test_env_null();
+
+ return 0;
}
Modified: webservices/axis2/trunk/c/modules/util/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/Makefile.am?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/util/src/Makefile.am Wed Nov 2 03:04:00 2005
@@ -11,4 +11,5 @@
axis2_qname.c
libaxis2_util_la_LIBADD = $(LDFLAGS)
-INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include
+INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include \
+ -I$(top_builddir)/modules/util/src
Modified: webservices/axis2/trunk/c/modules/util/src/Makefile.in
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/Makefile.in?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/Makefile.in (original)
+++ webservices/axis2/trunk/c/modules/util/src/Makefile.in Wed Nov 2 03:04:00 2005
@@ -204,7 +204,9 @@
axis2_qname.c
libaxis2_util_la_LIBADD = $(LDFLAGS)
-INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include
+INCLUDES = -I$(top_builddir)/include -I${CUTEST_HOME}/include \
+ -I$(top_builddir)/modules/util/src
+
all: all-am
.SUFFIXES:
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_environment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_environment.c?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_environment.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_environment.c Wed Nov 2 03:04:00 2005
@@ -74,3 +74,14 @@
return environment;
}
+
+AXIS2_DECLARE(axis2_status_t)
+axis2_environment_check_status (axis2_env_t *env)
+{
+ if(NULL == env)
+ {
+ AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_FAILURE);
+ AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_ENVIRONMENT_IS_NULL);
+ }
+ return AXIS2_ERROR_GET_STATUS_CODE(env->error);
+}
Modified: webservices/axis2/trunk/c/modules/util/src/axis2_error.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_error.c?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_error.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_error.c Wed Nov 2 03:04:00 2005
@@ -17,7 +17,18 @@
#include <stdlib.h>
#include "axis2_error_default.h"
-axis2_char_t * AXIS2_CALL axis2_error_impl_get_message (int error_number);
+axis2_char_t * AXIS2_CALL axis2_error_impl_get_message (axis2_error_t *error
+ , axis2_error_codes_t error_number);
+
+axis2_status_t AXIS2_CALL
+axis2_error_impl_set_error_number (axis2_error_t *error, axis2_error_codes_t error_number);
+
+axis2_status_t AXIS2_CALL
+axis2_error_impl_set_status_code (axis2_error_t *error, axis2_status_codes_t status_code);
+
+axis2_status_t AXIS2_CALL
+axis2_error_impl_get_status_code (axis2_error_t *error);
+
axis2_status_t AXIS2_CALL
axis2_error_impl_free (axis2_error_t *error)
@@ -57,13 +68,37 @@
}
error->ops->get_message = axis2_error_impl_get_message;
+ error->ops->set_error_number = axis2_error_impl_set_error_number;
+ error->ops->set_status_code = axis2_error_impl_set_status_code;
+ error->ops->get_status_code = axis2_error_impl_get_status_code;
+
return error;
}
axis2_char_t * AXIS2_CALL
-axis2_error_impl_get_message (int error_number)
+axis2_error_impl_get_message (axis2_error_t *error, axis2_error_codes_t error_number)
{
/** TODO: Need to fill in the error message list and get the error from that list */
return "This is the default error code";
+}
+
+axis2_status_t AXIS2_CALL
+axis2_error_impl_set_error_number (axis2_error_t *error, axis2_error_codes_t error_number)
+{
+ error->error_number = error_number;
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_error_impl_set_status_code (axis2_error_t *error, axis2_status_codes_t status_code)
+{
+ error->status_code = status_code;
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_error_impl_get_status_code (axis2_error_t *error)
+{
+ return error->status_code;
}
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=330233&r1=330232&r2=330233&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 03:04:00 2005
@@ -79,7 +79,7 @@
*/
static axis2_hash_entry_t **
-alloc_array (axis2_hash_t * ht, unsigned int max)
+alloc_array (axis2_hash_t *ht, unsigned int max)
{
return memset (AXIS2_MALLOC (ht->environment->allocator,
sizeof (*ht->array) * (max + 1)), 0,
@@ -87,7 +87,7 @@
}
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));
@@ -115,7 +115,7 @@
*/
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)
@@ -133,7 +133,7 @@
}
AXIS2_DECLARE(axis2_hash_index_t*)
-axis2_hash_first (axis2_env_t * environment, axis2_hash_t * ht)
+axis2_hash_first (axis2_hash_t *ht, axis2_env_t *environment)
{
axis2_hash_index_t *hi;
if (environment)
@@ -149,8 +149,8 @@
}
AXIS2_DECLARE(void)
-axis2_hash_this (axis2_hash_index_t * hi,
- const void **key, axis2_ssize_t * klen, void **val)
+axis2_hash_this (axis2_hash_index_t *hi,
+ const void **key, axis2_ssize_t *klen, void **val)
{
if (key)
*key = hi->this->key;
@@ -174,7 +174,7 @@
new_max = ht->max * 2 + 1;
new_array = alloc_array (ht, new_max);
- for (hi = axis2_hash_first (NULL, ht); hi;
+ for (hi = axis2_hash_first (ht, NULL); hi;
hi = axis2_hash_next (NULL, hi))
{
unsigned int i = hi->this->hash & new_max;
@@ -296,7 +296,7 @@
}
AXIS2_DECLARE(axis2_hash_t*)
-axis2_hash_copy (axis2_env_t * environment, const axis2_hash_t * orig)
+axis2_hash_copy (const axis2_hash_t *orig, axis2_env_t *environment)
{
axis2_hash_t *ht;
axis2_hash_entry_t *new_vals;
@@ -335,7 +335,7 @@
}
AXIS2_DECLARE(void*)
-axis2_hash_get (axis2_hash_t * ht, const void *key, axis2_ssize_t klen)
+axis2_hash_get (axis2_hash_t *ht, const void *key, axis2_ssize_t klen)
{
axis2_hash_entry_t *he;
he = *find_entry (ht, key, klen, NULL);
@@ -346,7 +346,7 @@
}
AXIS2_DECLARE(void)
-axis2_hash_set (axis2_hash_t * ht,
+axis2_hash_set (axis2_hash_t *ht,
const void *key, axis2_ssize_t klen, const void *val)
{
axis2_hash_entry_t **hep;
@@ -383,22 +383,17 @@
}
AXIS2_DECLARE(axis2_hash_t*)
-axis2_hash_overlay (axis2_env_t * environment,
- const axis2_hash_t * overlay, const axis2_hash_t * base)
+axis2_hash_overlay (const axis2_hash_t *overlay, axis2_env_t *environment
+ , const axis2_hash_t * base)
{
- return axis2_hash_merge (environment, overlay, base, NULL, NULL);
+ return axis2_hash_merge (overlay, environment, base, NULL, NULL);
}
AXIS2_DECLARE(axis2_hash_t*)
-axis2_hash_merge (axis2_env_t * environment,
- const axis2_hash_t * overlay,
- 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)
+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)
{
axis2_hash_t *res;
axis2_hash_entry_t *new_vals = NULL;
@@ -499,8 +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)
@@ -517,7 +511,7 @@
}
AXIS2_DECLARE(axis2_status_t)
-axis2_hash_free (axis2_env_t * environment, axis2_hash_t * ht)
+axis2_hash_free (axis2_hash_t *ht, axis2_env_t* environment)
{
if (ht)
{
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=330233&r1=330232&r2=330233&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 03:04:00 2005
@@ -64,21 +64,19 @@
* @param klen The length of the key, or AXIS2_HASH_KEY_STRING to use the string
* length. If AXIS2_HASH_KEY_STRING then returns the actual key length.
*/
- typedef unsigned int (*axis2_hashfunc_t) (const char *key,
- axis2_ssize_t * klen);
+ typedef unsigned int (*axis2_hashfunc_t) (const char *key, axis2_ssize_t *klen);
/**
* The default hash function.
*/
- unsigned int axis2_hashfunc_default (const char *key,
- axis2_ssize_t * klen);
+ unsigned int axis2_hashfunc_default (const char *key, axis2_ssize_t *klen);
/**
* Create a hash table.
* @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
@@ -86,18 +84,18 @@
* @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_hashfunc_t hash_func);
+ AXIS2_DECLARE(axis2_hash_t*) axis2_hash_make_custom (axis2_env_t *environment
+ , axis2_hashfunc_t hash_func);
/**
* Make a copy of a hash table
+ * @param ht The hash table to clone
* @param environment The environment from which to allocate the new hash table
- * @param h The hash table to clone
* @return The hash table just created
* @remark Makes a shallow copy
*/
- AXIS2_DECLARE(axis2_hash_t*) axis2_hash_copy (axis2_env_t * environment,
- const axis2_hash_t * h);
+ AXIS2_DECLARE(axis2_hash_t*) axis2_hash_copy (const axis2_hash_t *ht
+ , axis2_env_t *environment);
/**
* Associate a value with a key in a hash table.
@@ -107,8 +105,8 @@
* @param val Value to associate with the key
* @remark If the value is NULL the hash entry is deleted.
*/
- AXIS2_DECLARE(void) axis2_hash_set (axis2_hash_t * ht, const void *key,
- axis2_ssize_t klen, const void *val);
+ AXIS2_DECLARE(void) axis2_hash_set (axis2_hash_t *ht, const void *key
+ , axis2_ssize_t klen, const void *val);
/**
* Look up the value associated with a key in a hash table.
@@ -117,14 +115,14 @@
* @param klen Length of the key. Can be AXIS2_HASH_KEY_STRING to use the string length.
* @return Returns NULL if the key is not present.
*/
- AXIS2_DECLARE(void*) axis2_hash_get (axis2_hash_t * ht, const void *key,
- axis2_ssize_t klen);
+ AXIS2_DECLARE(void*) axis2_hash_get (axis2_hash_t *ht, const void *key
+ , axis2_ssize_t klen);
/**
* Start iterating over the entries in a hash table.
+ * @param ht The hash table
* @param p The environment to allocate the axis2_hash_index_t iterator. If this
* environment is NULL, then an internal, non-thread-safe iterator is used.
- * @param ht The hash table
* @remark There is no restriction on adding or deleting hash entries during
* an iteration (although the results may be unpredictable unless all you do
* is delete the current entry) and multiple iterations can be in
@@ -148,8 +146,8 @@
* }
* </PRE>
*/
- AXIS2_DECLARE(axis2_hash_index_t*) axis2_hash_first (axis2_env_t * environment,
- axis2_hash_t * ht);
+ AXIS2_DECLARE(axis2_hash_index_t*) axis2_hash_first (axis2_hash_t *ht
+ ,axis2_env_t *environment);
/**
* Continue iterating over the entries in a hash table.
@@ -157,7 +155,8 @@
* @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_hash_index_t * hi);
+ AXIS2_DECLARE(axis2_hash_index_t*) axis2_hash_next (axis2_env_t *environment
+ , axis2_hash_index_t *hi);
/**
* Get the current entry's details from the iteration state.
@@ -168,36 +167,35 @@
* @remark The return pointers should point to a variable that will be set to the
* corresponding data, or they may be NULL if the data isn't interesting.
*/
- AXIS2_DECLARE(void) axis2_hash_this (axis2_hash_index_t * hi, const void **key,
- axis2_ssize_t * klen, void **val);
+ AXIS2_DECLARE(void) axis2_hash_this (axis2_hash_index_t *hi, const void **key
+ , axis2_ssize_t *klen, void **val);
/**
* Get the number of key/value pairs in the hash table.
* @param ht The hash table
* @return The number of key/value pairs in the hash table.
*/
- unsigned int axis2_hash_count (axis2_hash_t * ht);
+ unsigned int axis2_hash_count (axis2_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.
- * @param p The environment to use for the new hash table
* @param overlay The table to add to the initial table
+ * @param p The environment to use for the new hash table
* @param base The table that represents the initial values of the new table
* @return A new hash table containing all of the data from the two passed in
*/
- AXIS2_DECLARE(axis2_hash_t*) axis2_hash_overlay (axis2_env_t * environment,
- const axis2_hash_t * overlay,
- const axis2_hash_t * base);
+ AXIS2_DECLARE(axis2_hash_t*) axis2_hash_overlay (const axis2_hash_t *overlay
+ ,axis2_env_t *environment, const axis2_hash_t *base);
/**
* Merge two hash tables into one new hash table. If the same key
* is present in both tables, call the supplied merge function to
* produce a merged value for the key in the new table. Both
* hash tables must use the same hash function.
- * @param p The environment to use for the new hash table
* @param h1 The first of the tables to merge
+ * @param p The environment to use for the new hash table
* @param h2 The second of the tables to merge
* @param merger A callback function to merge values, or NULL to
* make values from h1 override values from h2 (same semantics as
@@ -205,30 +203,24 @@
* @param data Client data to pass to the merger function
* @return A new hash table containing all of the data from the two passed in
*/
- AXIS2_DECLARE(axis2_hash_t*) axis2_hash_merge (axis2_env_t * environment,
- const axis2_hash_t * h1,
- 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);
-
+ AXIS2_DECLARE(axis2_hash_t*) axis2_hash_merge (const axis2_hash_t *h1
+ , 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);
+
/**
- * @param environment The environment to use for hash table
* @param ht hash table to be freed
+ * @param environment The environment to use for hash table
* @return return status code
*
*/
-AXIS2_DECLARE(axis2_status_t) axis2_hash_free(axis2_env_t *environment,
- axis2_hash_t *ht);
+AXIS2_DECLARE(axis2_status_t) axis2_hash_free(axis2_hash_t *ht
+ , axis2_env_t *environment);
-
+
/** @} */
Modified: webservices/axis2/trunk/c/modules/util/test/util_hash_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_hash_test.c?rev=330233&r1=330232&r2=330233&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_hash_test.c (original)
+++ webservices/axis2/trunk/c/modules/util/test/util_hash_test.c Wed Nov 2 03:04:00 2005
@@ -29,7 +29,7 @@
axis2_hash_set (ht, key1, AXIS2_HASH_KEY_STRING, actual);
- for (i = axis2_hash_first (environment, ht); i; i = axis2_hash_next (environment, i))
+ for (i = axis2_hash_first (ht, environment); i; i = axis2_hash_next (environment, i))
{
axis2_hash_this (i, NULL, NULL, &v);