You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2007/03/17 09:13:00 UTC
svn commit: r519261 [5/6] - in /webservices/axis2/trunk/c:
guththila/samples/ guththila/src/ rampart/samples/authn_provider/
rampart/samples/callback/ rampart/samples/callback/htpasswd_callback/
rampart/samples/client/sec_echo/ rampart/samples/omxmlsec...
Modified: webservices/axis2/trunk/c/util/src/file.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/file.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/file.c (original)
+++ webservices/axis2/trunk/c/util/src/file.c Sat Mar 17 01:12:54 2007
@@ -83,7 +83,7 @@
AXIS2_FREE(env->allocator, file->name);
file->name = NULL;
}
- file->name = AXIS2_STRDUP(name, env);
+ file->name = axis2_strdup(name, env);
if (!file->name)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -121,7 +121,7 @@
AXIS2_FREE(env->allocator, file->path);
file->path = NULL;
}
- file->path = AXIS2_STRDUP(path, env);
+ file->path = axis2_strdup(path, env);
if (!(file->path))
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
Modified: webservices/axis2/trunk/c/util/src/hash.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/hash.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/hash.c (original)
+++ webservices/axis2/trunk/c/util/src/hash.c Sat Mar 17 01:12:54 2007
@@ -521,7 +521,7 @@
axis2_hash_this(i, &v, NULL, NULL);
key_l = (const axis2_char_t *) v;
- if (0 == AXIS2_STRCMP(key, key_l))
+ if (0 == axis2_strcmp(key, key_l))
return AXIS2_TRUE;
}
Modified: webservices/axis2/trunk/c/util/src/log.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/log.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/log.c (original)
+++ webservices/axis2/trunk/c/util/src/log.c Sat Mar 17 01:12:54 2007
@@ -122,7 +122,7 @@
/* we write all logs to AXIS2C_HOME/logs if it is set otherwise
* to the working dir
*/
- if (stream_name && !(AXIS2_RINDEX(stream_name, AXIS2_PATH_SEP_CHAR)))
+ if (stream_name && !(axis2_rindex(stream_name, AXIS2_PATH_SEP_CHAR)))
{
if ((path_home = AXIS2_GETENV("AXIS2C_HOME")))
{
Modified: webservices/axis2/trunk/c/util/src/minizip/archive_extract.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/minizip/archive_extract.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/minizip/archive_extract.c (original)
+++ webservices/axis2/trunk/c/util/src/minizip/archive_extract.c Sat Mar 17 01:12:54 2007
@@ -322,7 +322,7 @@
return (AXIS2_FALSE);
}
- ptr = AXIS2_RINDEX(namelist[n]->d_name, '.');
+ ptr = axis2_rindex(namelist[n]->d_name, '.');
if ((ptr) &&
(((strcmp(ptr, AXIS2_AAR_SUFFIX) == 0)) || (strcmp(ptr, AXIS2_MAR_SUFFIX) == 0)))
for (i = 0;i < n;i++)
Modified: webservices/axis2/trunk/c/util/src/param.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/param.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/param.c (original)
+++ webservices/axis2/trunk/c/util/src/param.c Sat Mar 17 01:12:54 2007
@@ -34,7 +34,7 @@
axis2_array_list_t *value_list;
axis2_status_t (AXIS2_CALL *
value_free) (void *param_value,
- const axis2_env_t *env);
+ const axis2_env_t *env);
};
AXIS2_EXTERN axis2_param_t* AXIS2_CALL
@@ -54,7 +54,7 @@
return NULL;
}
- param->name = AXIS2_STRDUP(name, env);
+ param->name = axis2_strdup(name, env);
param->value = value; /* shallow copy.*/
param->locked = AXIS2_FALSE;
param->type = AXIS2_TEXT_PARAM;
@@ -69,8 +69,6 @@
axis2_param_get_name(axis2_param_t *param,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
-
return param->name;
}
@@ -78,8 +76,6 @@
axis2_param_get_value(axis2_param_t *param,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
-
return param->value;
}
@@ -90,7 +86,7 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- param->name = AXIS2_STRDUP(name, env);
+ param->name = axis2_strdup(name, env);
return AXIS2_SUCCESS;
}
@@ -141,8 +137,6 @@
axis2_param_get_param_type(axis2_param_t *param,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
return param->type;
}
@@ -155,12 +149,10 @@
param->type = type;
return AXIS2_SUCCESS;
-
}
axis2_status_t AXIS2_CALL
-axis2_param_set_attributes(
- axis2_param_t *param,
+axis2_param_set_attributes(axis2_param_t *param,
const axis2_env_t *env,
axis2_hash_t *attrs)
{
@@ -173,33 +165,27 @@
void *v = NULL;
for (i = axis2_hash_first(param->attrs, env); i;
- i = axis2_hash_next(env, i))
+ i = axis2_hash_next(env, i))
{
axis2_hash_this(i, NULL, NULL, &v);
- axis2_generic_obj_free(v, env);
+ axis2_generic_obj_free(v, env);
}
axis2_hash_free(param->attrs, env);
}
param->attrs = attrs;
return AXIS2_SUCCESS;
-
-
}
axis2_hash_t* AXIS2_CALL
-axis2_param_get_attributes(
- axis2_param_t *param,
+axis2_param_get_attributes(axis2_param_t *param,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
-
return param->attrs;
}
axis2_status_t AXIS2_CALL
-axis2_param_set_value_list(
- axis2_param_t *param,
+axis2_param_set_value_list(axis2_param_t *param,
const axis2_env_t *env,
axis2_array_list_t *value_list)
{
@@ -216,8 +202,8 @@
axis2_param_t *param = NULL;
param = (axis2_param_t *) axis2_array_list_get(
- param->value_list, env, i);
- AXIS2_PARAM_FREE(param, env);
+ param->value_list, env, i);
+ axis2_param_free(param, env);
}
axis2_array_list_free(param->value_list, env);
}
@@ -227,12 +213,9 @@
}
axis2_array_list_t* AXIS2_CALL
-axis2_param_get_value_list(
- axis2_param_t *param,
+axis2_param_get_value_list(axis2_param_t *param,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
-
return param->value_list;
}
@@ -264,10 +247,10 @@
void *v = NULL;
for (i = axis2_hash_first(param->attrs, env); i;
- i = axis2_hash_next(env, i))
+ i = axis2_hash_next(env, i))
{
axis2_hash_this(i, NULL, NULL, &v);
- axis2_generic_obj_free(v, env);
+ axis2_generic_obj_free(v, env);
}
axis2_hash_free(param->attrs, env);
}
@@ -282,10 +265,10 @@
axis2_param_t *param_l = NULL;
param_l = (axis2_param_t *) axis2_array_list_get(
- param->value_list, env, i);
+ param->value_list, env, i);
if (param_l)
{
- AXIS2_PARAM_FREE(param_l, env);
+ axis2_param_free(param_l, env);
}
}
axis2_array_list_free(param->value_list, env);
Modified: webservices/axis2/trunk/c/util/src/param_container.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/param_container.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/param_container.c (original)
+++ webservices/axis2/trunk/c/util/src/param_container.c Sat Mar 17 01:12:54 2007
@@ -31,9 +31,9 @@
AXIS2_ENV_CHECK(env, NULL);
param_container = (axis2_param_container_t *) AXIS2_MALLOC(env->
- allocator, sizeof(axis2_param_container_t));
+ allocator, sizeof(axis2_param_container_t));
- if (NULL == param_container)
+ if (!param_container)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
@@ -44,7 +44,7 @@
param_container->params_list = axis2_array_list_create(env, 0);
param_container->params = axis2_hash_make(env);
- if (NULL == param_container->params)
+ if (!param_container->params)
{
axis2_param_container_free(param_container, env);
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -56,7 +56,7 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_param_container_free(axis2_param_container_t *param_container,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
axis2_status_t status = AXIS2_SUCCESS;
@@ -67,14 +67,14 @@
axis2_hash_index_t *hi = NULL;
void *val = NULL;
for (hi = axis2_hash_first(param_container->params, env); hi;
- hi = axis2_hash_next(env, hi))
+ hi = axis2_hash_next(env, hi))
{
axis2_param_t *param = NULL;
axis2_hash_this(hi, NULL, NULL, &val);
param = (axis2_param_t *) val;
if (param)
{
- AXIS2_PARAM_FREE(param, env);
+ axis2_param_free(param, env);
param = NULL;
}
val = NULL;
@@ -97,7 +97,7 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_param_container_free_void_arg(void *param_container,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
axis2_param_container_t *param_container_l = NULL;
@@ -108,15 +108,15 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_param_container_add_param(axis2_param_container_t *param_container,
- const axis2_env_t *env,
- axis2_param_t *param)
+ const axis2_env_t *env,
+ axis2_param_t *param)
{
axis2_char_t *param_name = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, param, AXIS2_FAILURE);
- if (NULL == param_container->params)
+ if (!(param_container->params))
{
param_container->params = axis2_hash_make(env);
if (!param_container->params)
@@ -124,11 +124,11 @@
return AXIS2_FAILURE;
}
}
- param_name = AXIS2_PARAM_GET_NAME(param, env);
+ param_name = axis2_param_get_name(param, env);
if (!param_name)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_PARAM,
- AXIS2_FAILURE);
+ AXIS2_FAILURE);
return AXIS2_FAILURE;
}
axis2_hash_set(param_container->params, param_name,
@@ -139,42 +139,38 @@
AXIS2_EXTERN axis2_param_t * AXIS2_CALL
axis2_param_container_get_param(axis2_param_container_t *param_container,
- const axis2_env_t *env,
- const axis2_char_t *name)
+ const axis2_env_t *env,
+ const axis2_char_t *name)
{
- AXIS2_ENV_CHECK(env, NULL);
-
return (axis2_param_t *)(axis2_hash_get(param_container->params,
name, AXIS2_HASH_KEY_STRING));
}
AXIS2_EXTERN axis2_array_list_t * AXIS2_CALL
axis2_param_container_get_params(axis2_param_container_t *param_container,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
axis2_hash_index_t *index_i = 0;
axis2_status_t status = AXIS2_FAILURE;
void *value = NULL;
- AXIS2_ENV_CHECK(env, NULL);
-
if (!param_container->params_list)
{
param_container->params_list = axis2_array_list_create(env, 0);
if (!param_container->params_list)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
- AXIS2_FAILURE);
+ AXIS2_FAILURE);
return NULL;
}
}
for (index_i = axis2_hash_first(param_container->params, env);
- index_i; index_i = axis2_hash_next(env, index_i))
+ index_i; index_i = axis2_hash_next(env, index_i))
{
axis2_hash_this(index_i, NULL, NULL, &value);
status = axis2_array_list_add(param_container->params_list, env,
- value);
+ value);
if (AXIS2_SUCCESS != status)
{
axis2_array_list_free(param_container->params_list , env);
@@ -187,8 +183,8 @@
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axis2_param_container_is_param_locked(axis2_param_container_t *param_container,
- const axis2_env_t *env,
- const axis2_char_t *param_name)
+ const axis2_env_t *env,
+ const axis2_char_t *param_name)
{
axis2_param_t *param = NULL;
@@ -201,6 +197,6 @@
/* In this case we consider param is not locked */
return AXIS2_FALSE;
}
- return AXIS2_PARAM_IS_LOCKED(param, env);
+ return axis2_param_is_locked(param, env);
}
Modified: webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c (original)
+++ webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c Sat Mar 17 01:12:54 2007
@@ -25,7 +25,7 @@
axis2_threadattr_t *new = NULL;
new = AXIS2_MALLOC(allocator, sizeof(axis2_threadattr_t));
- if (NULL == new)
+ if (!new)
{
return NULL;
}
@@ -87,7 +87,7 @@
AXIS2_EXTERN axis2_thread_t* AXIS2_CALL
axis2_thread_create(axis2_allocator_t* allocator, axis2_threadattr_t *attr,
- axis2_thread_start_t func, void *data)
+ axis2_thread_start_t func, void *data)
{
axis2_status_t stat;
pthread_attr_t *temp = NULL;
@@ -95,12 +95,12 @@
new = (axis2_thread_t *)AXIS2_MALLOC(allocator, sizeof(axis2_thread_t));
- if (NULL == new)
+ if (!new)
{
return NULL;
}
new->td = (pthread_t *)AXIS2_MALLOC(allocator, sizeof(pthread_t));
- if (NULL == new->td)
+ if (!new->td)
{
return NULL;
}
@@ -144,10 +144,8 @@
if (thd->td)
{
AXIS2_FREE(allocator, thd->td);
- thd->td = NULL;
}
AXIS2_FREE(allocator, thd);
- thd = NULL;
}
pthread_exit(NULL);
return AXIS2_SUCCESS;
@@ -234,7 +232,7 @@
AXIS2_EXTERN axis2_os_thread_t* AXIS2_CALL
axis2_os_thread_get(axis2_thread_t *thd)
{
- if (NULL == thd)
+ if (!thd)
{
return NULL;
}
@@ -247,7 +245,7 @@
static const pthread_once_t once_init = PTHREAD_ONCE_INIT;
axis2_thread_once_t *control = AXIS2_MALLOC(allocator,
sizeof(axis2_thread_once_t));
- if (NULL == control)
+ if (!control)
{
return NULL;
;
Modified: webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c (original)
+++ webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c Sat Mar 17 01:12:54 2007
@@ -83,8 +83,8 @@
/* check whether system time changed since last retrieve */
if (!(time_now.tv_sec == axis2_uuid_static.time_last.tv_sec
- && time_now.tv_usec ==
- axis2_uuid_static.time_last.tv_usec))
+ && time_now.tv_usec ==
+ axis2_uuid_static.time_last.tv_usec))
{
/* reset time sequence counter and continue */
axis2_uuid_static.time_seq = 0;
@@ -138,9 +138,8 @@
/* generate new random clock sequence (initially or if the
time has stepped backwards) or else just increase it */
if (clck == 0 || (time_now.tv_sec < axis2_uuid_static.time_last.tv_sec ||
- (time_now.tv_sec == axis2_uuid_static.time_last.tv_sec
- && time_now.tv_usec <
- axis2_uuid_static.time_last.tv_usec)))
+ (time_now.tv_sec == axis2_uuid_static.time_last.tv_sec
+ && time_now.tv_usec < axis2_uuid_static.time_last.tv_usec)))
{
srand(time_now.tv_usec);
clck = rand();
@@ -198,10 +197,10 @@
}
memcpy(mac, uuid_struct->mac_addr, 6);
sprintf(mac_hex, "%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3]
- , mac[4], mac[5]);
+ , mac[4], mac[5]);
sprintf(uuid_str, "%08x-%04x-%04x-%04x-%s", uuid_struct->time_low,
- uuid_struct->time_mid, uuid_struct->time_high_version,
- uuid_struct->clock_variant, mac_hex);
+ uuid_struct->time_mid, uuid_struct->time_high_version,
+ uuid_struct->clock_variant, mac_hex);
free(uuid_struct);
uuid_struct = NULL;
return uuid_str;
Modified: webservices/axis2/trunk/c/util/src/properties.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/properties.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/properties.c (original)
+++ webservices/axis2/trunk/c/util/src/properties.c Sat Mar 17 01:12:54 2007
@@ -19,16 +19,21 @@
#include <axis2_string.h>
#include <axis2_utils.h>
+
+#define MAX_SIZE 1024
+#define MAX_ALLOC (MAX_SIZE * 64)
+
axis2_char_t*
axis2_properties_read(FILE* input,
- const axis2_env_t* env);
+ const axis2_env_t* env);
axis2_char_t*
axis2_properties_read_next(axis2_char_t* cur);
axis2_char_t*
-axis2_properties_trunk_and_dup(axis2_char_t* start, axis2_char_t* end,
- const axis2_env_t* env);
+axis2_properties_trunk_and_dup(axis2_char_t* start,
+ axis2_char_t* end,
+ const axis2_env_t* env);
struct axis2_properties
{
@@ -43,9 +48,9 @@
AXIS2_ENV_CHECK(env, NULL);
properties= (axis2_properties_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_properties_t));
+ sizeof(axis2_properties_t));
- if (NULL == properties)
+ if (!properties)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
@@ -57,7 +62,7 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_properties_free(axis2_properties_t *properties,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
axis2_char_t *key = NULL;
axis2_char_t *value = NULL;
@@ -68,13 +73,17 @@
if (properties->prop_hash)
{
for (hi = axis2_hash_first(properties->prop_hash, env);
- hi; hi = axis2_hash_next(env, hi))
+ hi; hi = axis2_hash_next(env, hi))
{
axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
if (key)
+ {
AXIS2_FREE(env-> allocator, key);
+ }
if (value)
+ {
AXIS2_FREE(env-> allocator, value);
+ }
}
axis2_hash_free(properties->prop_hash, env);
}
@@ -82,50 +91,46 @@
if (properties)
{
AXIS2_FREE(env->allocator, properties);
- properties = NULL;
}
return AXIS2_SUCCESS;
}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
axis2_properties_get_property(axis2_properties_t *properties,
- const axis2_env_t *env,
- axis2_char_t *key)
+ const axis2_env_t *env,
+ axis2_char_t *key)
{
- AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK(env-> error, key, NULL);
return axis2_hash_get(properties-> prop_hash,
- key, AXIS2_HASH_KEY_STRING);
+ key, AXIS2_HASH_KEY_STRING);
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_properties_set_property(axis2_properties_t *properties,
- const axis2_env_t *env,
- axis2_char_t *key,
- axis2_char_t *value)
+ const axis2_env_t *env,
+ axis2_char_t *key,
+ axis2_char_t *value)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env-> error, key, AXIS2_FAILURE);
axis2_hash_set(properties-> prop_hash, key,
- AXIS2_HASH_KEY_STRING, value);
+ AXIS2_HASH_KEY_STRING, value);
return AXIS2_SUCCESS;
}
AXIS2_EXTERN axis2_hash_t* AXIS2_CALL
axis2_properties_get_all(axis2_properties_t *properties,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
-
return properties-> prop_hash;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_properties_store(axis2_properties_t *properties,
- const axis2_env_t *env,
- FILE *output)
+ const axis2_env_t *env,
+ FILE *output)
{
axis2_hash_index_t *hi = NULL;
axis2_char_t *key = NULL;
@@ -137,14 +142,14 @@
if (properties->prop_hash)
{
for (hi = axis2_hash_first(properties->prop_hash, env);
- hi; hi = axis2_hash_next(env, hi))
+ hi; hi = axis2_hash_next(env, hi))
{
axis2_hash_this(hi, (void*)&key, NULL, (void*)&value);
if (key)
{
- if (NULL == value)
+ if (!value)
{
- value = AXIS2_STRDUP("", env);
+ value = axis2_strdup("", env);
}
fprintf(output, "%s=%s\n", key, value);
}
@@ -155,10 +160,10 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_properties_load(axis2_properties_t *properties,
- const axis2_env_t *env,
- axis2_char_t *input_filename)
+ const axis2_env_t *env,
+ axis2_char_t *input_filename)
{
- FILE *input = NULL;
+ FILE *input = NULL;
axis2_char_t *cur = NULL;
axis2_char_t *tag = NULL;
const int LINE_STARTED = -1;
@@ -177,16 +182,18 @@
prop_hash = properties-> prop_hash;
- input = fopen(input_filename, "r+");
- if(!input)
- return AXIS2_FAILURE;
+ input = fopen(input_filename, "r+");
+ if(!input)
+ {
+ return AXIS2_FAILURE;
+ }
buffer = axis2_properties_read(input, env);
- if (buffer == NULL)
+ if (!buffer)
{
sprintf(loginfo, "error in reading file\n");
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- loginfo);
+ loginfo);
AXIS2_FREE(env-> allocator, buffer);
return AXIS2_FAILURE;
}
@@ -194,7 +201,7 @@
for (cur = axis2_properties_read_next(buffer); *cur ;
- cur = axis2_properties_read_next(++cur))
+ cur = axis2_properties_read_next(++cur))
{
if (*cur == '\r')
{
@@ -213,7 +220,7 @@
{
sprintf(loginfo, "equal apear in wrong place around %s\n", tag);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- loginfo);
+ loginfo);
AXIS2_FREE(env-> allocator, buffer);
return AXIS2_FAILURE;
}
@@ -234,7 +241,7 @@
{
tag = axis2_properties_trunk_and_dup(tag, cur, env);
axis2_hash_set(prop_hash,
- key, AXIS2_HASH_KEY_STRING, tag);
+ key, AXIS2_HASH_KEY_STRING, tag);
}
status = LINE_STARTED;
}
@@ -244,19 +251,21 @@
*cur = '\0';
tag = axis2_properties_trunk_and_dup(tag, cur, env);
axis2_hash_set(prop_hash,
- key, AXIS2_HASH_KEY_STRING, tag);
+ key, AXIS2_HASH_KEY_STRING, tag);
status = LINE_STARTED;
}
if (status != LINE_STARTED)
{
sprintf(loginfo, "error parsing properties\n");
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- loginfo);
+ loginfo);
AXIS2_FREE(env-> allocator, buffer);
return AXIS2_FAILURE;
}
if(input)
- fclose(input);
+ {
+ fclose(input);
+ }
AXIS2_FREE(env-> allocator, buffer);
return AXIS2_SUCCESS;
}
@@ -281,22 +290,20 @@
}
axis2_char_t*
-axis2_properties_trunk_and_dup(axis2_char_t* start, axis2_char_t* end,
- const axis2_env_t* env)
+axis2_properties_trunk_and_dup(axis2_char_t* start,
+ axis2_char_t* end,
+ const axis2_env_t* env)
{
for (; *start == ' '; start ++); /* remove front spaces */
for (end --; *end == ' '; end --); /* remove rear spaces */
*(++end) = '\0';
- start = (axis2_char_t*)AXIS2_STRDUP(start, env);
+ start = (axis2_char_t*)axis2_strdup(start, env);
return start;
}
-#define MAX_SIZE 1024
-#define MAX_ALLOC (MAX_SIZE * 64)
-
axis2_char_t*
axis2_properties_read(FILE* input,
- const axis2_env_t* env)
+ const axis2_env_t* env)
{
int nread = 0;
axis2_char_t* out_stream = NULL;
@@ -305,8 +312,8 @@
size_t total_alloc = curr_alloc;
out_stream = (axis2_char_t*) AXIS2_MALLOC(env-> allocator,
- sizeof(axis2_char_t) * curr_alloc);
- if (out_stream == NULL)
+ sizeof(axis2_char_t) * curr_alloc);
+ if (!out_stream)
{
return NULL;
}
@@ -314,7 +321,7 @@
do
{
nread = fread(out_stream + ncount, sizeof(axis2_char_t), MAX_SIZE,
- input);
+ input);
ncount += nread;
if (ncount + MAX_SIZE > total_alloc)
@@ -327,8 +334,8 @@
total_alloc += curr_alloc;
new_stream = AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * total_alloc);
- if (new_stream == NULL)
+ sizeof(axis2_char_t) * total_alloc);
+ if (!new_stream)
{
return NULL;
}
Modified: webservices/axis2/trunk/c/util/src/property.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/property.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/property.c (original)
+++ webservices/axis2/trunk/c/util/src/property.c Sat Mar 17 01:12:54 2007
@@ -34,9 +34,9 @@
AXIS2_ENV_CHECK(env, NULL);
property = (axis2_property_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_property_t));
+ sizeof(axis2_property_t));
- if (NULL == property)
+ if (!property)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
@@ -50,8 +50,7 @@
}
/*****************************************************************************/
axis2_property_t *AXIS2_CALL
-axis2_property_create_with_args(
- const axis2_env_t *env,
+axis2_property_create_with_args(const axis2_env_t *env,
axis2_scope_t scope,
axis2_bool_t own_value,
AXIS2_FREE_VOID_ARG free_func,
@@ -63,7 +62,7 @@
property = (axis2_property_t *) axis2_property_create(env);
- if (NULL == property)
+ if (!property)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
@@ -80,7 +79,7 @@
axis2_status_t AXIS2_CALL
axis2_property_free(axis2_property_t *property,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -96,22 +95,20 @@
{
AXIS2_FREE(env->allocator, property->value);
}
- property->value = NULL;
}
}
if (property)
{
AXIS2_FREE(env->allocator, property);
- property = NULL;
}
return AXIS2_SUCCESS;
}
axis2_status_t AXIS2_CALL
axis2_property_set_scope(axis2_property_t *property,
- const axis2_env_t *env,
- axis2_scope_t scope)
+ const axis2_env_t *env,
+ axis2_scope_t scope)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -121,8 +118,8 @@
axis2_status_t AXIS2_CALL
axis2_property_set_free_func(axis2_property_t *property,
- const axis2_env_t *env,
- AXIS2_FREE_VOID_ARG free_func)
+ const axis2_env_t *env,
+ AXIS2_FREE_VOID_ARG free_func)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -131,8 +128,7 @@
}
axis2_status_t AXIS2_CALL
-axis2_property_set_value(
- axis2_property_t *property,
+axis2_property_set_value(axis2_property_t *property,
const axis2_env_t *env,
void *value)
{
@@ -150,7 +146,6 @@
{
AXIS2_FREE(env->allocator, property->value);
}
- property->value = NULL;
}
}
@@ -160,16 +155,13 @@
void *AXIS2_CALL
axis2_property_get_value(axis2_property_t *property,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
-
return property->value;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axis2_property_set_own_value(
- axis2_property_t *property,
+axis2_property_set_own_value(axis2_property_t *property,
const axis2_env_t *env,
axis2_bool_t own_value)
{
@@ -181,8 +173,7 @@
axis2_property_t* AXIS2_CALL
-axis2_property_clone(
- axis2_property_t *property,
+axis2_property_clone(axis2_property_t *property,
const axis2_env_t *env)
{
axis2_property_t *new_property = NULL;
Modified: webservices/axis2/trunk/c/util/src/qname.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/qname.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/qname.c (original)
+++ webservices/axis2/trunk/c/util/src/qname.c Sat Mar 17 01:12:54 2007
@@ -68,7 +68,7 @@
qname->ref = 1;
- qname->localpart = (axis2_char_t *)AXIS2_STRDUP(localpart, env);
+ qname->localpart = (axis2_char_t *)axis2_strdup(localpart, env);
if (!(qname->localpart))
{
AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_NO_MEMORY);
@@ -77,15 +77,9 @@
return NULL;
}
- /** if prefix is null it is set to "" */
- /*if (!prefix)
- {
- qname->prefix = (axis2_char_t*)AXIS2_STRDUP("", env);
- }
- else*/
if (prefix)
{
- qname->prefix = (axis2_char_t*)AXIS2_STRDUP(prefix, env);
+ qname->prefix = (axis2_char_t*)axis2_strdup(prefix, env);
}
if (prefix && !(qname->prefix))
@@ -96,15 +90,9 @@
return NULL;
}
- /** if uri is null it is set to ""*/
- /*if (!namespace_uri)
- {
- qname->namespace_uri = (axis2_char_t*)AXIS2_STRDUP("", env);
- }
- else*/
if (namespace_uri)
{
- qname->namespace_uri = (axis2_char_t*)AXIS2_STRDUP(namespace_uri, env);
+ qname->namespace_uri = (axis2_char_t*)axis2_strdup(namespace_uri, env);
}
if (namespace_uri && !(qname->namespace_uri))
@@ -128,27 +116,25 @@
qname->ref--;
if (qname->ref > 0)
+ {
return AXIS2_SUCCESS;
+ }
if (qname->localpart)
{
AXIS2_FREE(env->allocator, qname->localpart);
- qname->localpart = NULL;
}
if (qname->namespace_uri)
{
AXIS2_FREE(env->allocator, qname->namespace_uri);
- qname->namespace_uri = NULL;
}
if (qname->prefix)
{
AXIS2_FREE(env->allocator, qname->prefix);
- qname->prefix = NULL;
}
if (qname->qname_string)
{
AXIS2_FREE(env->allocator, qname->qname_string);
- qname->qname_string = NULL;
}
AXIS2_FREE(env->allocator, qname);
@@ -178,7 +164,7 @@
{
localparts_differ =
axis2_strcmp(qname->localpart,
- qname2->localpart);
+ qname2->localpart);
}
else
{
@@ -189,7 +175,7 @@
{
uris_differ =
axis2_strcmp(qname->namespace_uri,
- qname2->namespace_uri);
+ qname2->namespace_uri);
}
else
{
@@ -207,14 +193,12 @@
AXIS2_ENV_CHECK(env, NULL);
if (!qname)
+ {
return NULL;
+ }
qname->ref++;
- /*return axis2_qname_create(env, qname->localpart,
- qname->namespace_uri,
- qname->prefix);*/
-
return qname;
}
@@ -222,7 +206,6 @@
axis2_qname_get_uri(const axis2_qname_t *qname,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
return qname->namespace_uri;
}
@@ -230,7 +213,6 @@
axis2_qname_get_prefix(const axis2_qname_t *qname,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
return qname->prefix;
}
@@ -239,7 +221,6 @@
axis2_qname_get_localpart(const axis2_qname_t *qname,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
return qname->localpart;
}
@@ -253,20 +234,19 @@
return qname->qname_string;
}
- if (!(qname->namespace_uri) || AXIS2_STRCMP(qname->namespace_uri, "") == 0)
+ if (!(qname->namespace_uri) || axis2_strcmp(qname->namespace_uri, "") == 0)
{
- qname->qname_string = AXIS2_STRDUP(qname->localpart, env);
+ qname->qname_string = axis2_strdup(qname->localpart, env);
}
- else if (!(qname->prefix) || AXIS2_STRCMP(qname->prefix, "") == 0)
+ else if (!(qname->prefix) || axis2_strcmp(qname->prefix, "") == 0)
{
axis2_char_t *temp_string1 = NULL;
- temp_string1 = AXIS2_STRACAT(qname->localpart, "|", env);
- qname->qname_string = AXIS2_STRACAT(temp_string1, qname->namespace_uri, env);
+ temp_string1 = axis2_stracat(qname->localpart, "|", env);
+ qname->qname_string = axis2_stracat(temp_string1, qname->namespace_uri, env);
if (temp_string1)
{
AXIS2_FREE(env->allocator, temp_string1);
- temp_string1 = NULL;
}
}
else
@@ -275,25 +255,22 @@
axis2_char_t *temp_string2 = NULL;
axis2_char_t *temp_string3 = NULL;
- temp_string1 = AXIS2_STRACAT(qname->localpart, "|", env);
- temp_string2 = AXIS2_STRACAT(temp_string1, qname->namespace_uri, env);
- temp_string3 = AXIS2_STRACAT(temp_string2, "|", env);
- qname->qname_string = AXIS2_STRACAT(temp_string3, qname->prefix, env);
+ temp_string1 = axis2_stracat(qname->localpart, "|", env);
+ temp_string2 = axis2_stracat(temp_string1, qname->namespace_uri, env);
+ temp_string3 = axis2_stracat(temp_string2, "|", env);
+ qname->qname_string = axis2_stracat(temp_string3, qname->prefix, env);
if (temp_string1)
{
AXIS2_FREE(env->allocator, temp_string1);
- temp_string1 = NULL;
}
if (temp_string2)
{
AXIS2_FREE(env->allocator, temp_string2);
- temp_string2 = NULL;
}
if (temp_string3)
{
AXIS2_FREE(env->allocator, temp_string3);
- temp_string3 = NULL;
}
}
return qname->qname_string;
@@ -310,10 +287,10 @@
axis2_char_t *next = NULL;
axis2_char_t *temp_string = NULL;
axis2_qname_t *qname = NULL;
- if (!qstring || AXIS2_STRCMP(qstring, "") == 0)
+ if (!qstring || axis2_strcmp(qstring, "") == 0)
return NULL;
- temp_string = AXIS2_STRDUP(qstring, env);
+ temp_string = axis2_strdup(qstring, env);
index = strchr(temp_string, '|');
if (index)
@@ -347,7 +324,6 @@
if (temp_string)
{
AXIS2_FREE(env->allocator, temp_string);
- temp_string = NULL;
}
return qname;
}
Modified: webservices/axis2/trunk/c/util/src/rand.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/rand.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/rand.c (original)
+++ webservices/axis2/trunk/c/util/src/rand.c Sat Mar 17 01:12:54 2007
@@ -22,16 +22,14 @@
#define AXIS2_RAND_MAX 32768
AXIS2_EXTERN int AXIS2_CALL
-axis2_rand(
- unsigned int *seedp)
+axis2_rand(unsigned int *seedp)
{
*seedp = *seedp * 1103515245 + 12345;
return((unsigned)(*seedp/(2 * AXIS2_RAND_MAX)) % AXIS2_RAND_MAX);
}
AXIS2_EXTERN int AXIS2_CALL
-axis2_rand_with_range(
- unsigned int *seedp,
+axis2_rand_with_range(unsigned int *seedp,
int start,
int end)
{
@@ -48,8 +46,7 @@
}
AXIS2_EXTERN unsigned int AXIS2_CALL
-axis2_rand_get_seed_value_based_on_time(
- const axis2_env_t *env)
+axis2_rand_get_seed_value_based_on_time(const axis2_env_t *env)
{
axis2_date_time_t *date = axis2_date_time_create(env);
unsigned int rand_var = axis2_date_time_get_year(date, env);
Modified: webservices/axis2/trunk/c/util/src/stack.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/stack.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/stack.c (original)
+++ webservices/axis2/trunk/c/util/src/stack.c Sat Mar 17 01:12:54 2007
@@ -41,7 +41,7 @@
AXIS2_ENV_CHECK(env, NULL);
stack = (axis2_stack_t*)AXIS2_MALLOC(env->allocator,
- sizeof(axis2_stack_t));
+ sizeof(axis2_stack_t));
if (!stack)
{
@@ -55,8 +55,8 @@
stack->is_empty_stack = AXIS2_TRUE;
stack->data = AXIS2_MALLOC(env->allocator, sizeof(void*) *
- AXIS2_STACK_DEFAULT_CAPACITY);
- if (NULL == stack->data)
+ AXIS2_STACK_DEFAULT_CAPACITY);
+ if (!stack->data)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
axis2_stack_free(stack , env);
@@ -68,29 +68,27 @@
axis2_status_t AXIS2_CALL
axis2_stack_free(axis2_stack_t *stack,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
if (stack->data)
{
AXIS2_FREE(env->allocator, stack->data);
- stack->data = NULL;
}
AXIS2_FREE(env->allocator, stack);
- stack = NULL;
return AXIS2_SUCCESS;
}
void* AXIS2_CALL
axis2_stack_pop(axis2_stack_t *stack,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
void *value = NULL;
AXIS2_ENV_CHECK(env, NULL);
if (stack->is_empty_stack == AXIS2_TRUE ||
- stack->size == 0)
+ stack->size == 0)
{
return NULL;
}
@@ -109,8 +107,8 @@
axis2_status_t AXIS2_CALL
axis2_stack_push(axis2_stack_t *stack,
- const axis2_env_t *env,
- void* value)
+ const axis2_env_t *env,
+ void* value)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE);
@@ -136,7 +134,6 @@
stack->capacity = new_capacity;
AXIS2_FREE(env->allocator, stack->data);
- stack->data = NULL;
stack->data = new_data;
stack->data[stack->size++] = value;
@@ -147,7 +144,7 @@
int AXIS2_CALL
axis2_stack_size(axis2_stack_t *stack,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
return stack->size;
@@ -155,9 +152,8 @@
void * AXIS2_CALL
axis2_stack_get(axis2_stack_t *stack,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
if (stack->size > 0)
{
return stack->data[stack->size-1];
@@ -167,8 +163,8 @@
void* AXIS2_CALL
axis2_stack_get_at(axis2_stack_t *stack,
- const axis2_env_t *env,
- int i)
+ const axis2_env_t *env,
+ int i)
{
if ((stack->size == 0) || (i < 0) || (i >= stack->size))
{
Modified: webservices/axis2/trunk/c/util/src/stream.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/stream.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/stream.c (original)
+++ webservices/axis2/trunk/c/util/src/stream.c Sat Mar 17 01:12:54 2007
@@ -44,50 +44,72 @@
/********************************Function headers******************************/
axis2_status_t AXIS2_CALL
-axis2_stream_free(axis2_stream_t *stream, const axis2_env_t *env);
+axis2_stream_free(axis2_stream_t *stream,
+ const axis2_env_t *env);
axis2_status_t AXIS2_CALL
axis2_stream_free_void_arg(void *stream,
- const axis2_env_t *env);
+ const axis2_env_t *env);
/** basic stream operatons **/
int AXIS2_CALL
-axis2_stream_write_basic(axis2_stream_t *stream, const axis2_env_t *env,
- const void *buffer, size_t count);
+axis2_stream_write_basic(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ const void *buffer, size_t count);
+
int AXIS2_CALL
-axis2_stream_read_basic(axis2_stream_t *stream, const axis2_env_t *env,
- void *buffer, size_t count);
+axis2_stream_read_basic(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ void *buffer, size_t count);
+
int AXIS2_CALL
-axis2_stream_get_len_basic(axis2_stream_t *stream, const axis2_env_t *env);
+axis2_stream_get_len_basic(axis2_stream_t *stream,
+ const axis2_env_t *env);
int AXIS2_CALL
-axis2_stream_skip_basic(axis2_stream_t *stream, const axis2_env_t *env, int count);
+axis2_stream_skip_basic(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ int count);
/** file stream operations **/
int AXIS2_CALL
-axis2_stream_write_file(axis2_stream_t *stream, const axis2_env_t *env,
- const void *buffer, size_t count);
+axis2_stream_write_file(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ const void *buffer, size_t count);
+
int AXIS2_CALL
-axis2_stream_read_file(axis2_stream_t *stream, const axis2_env_t *env,
- void *buffer, size_t count);
+axis2_stream_read_file(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ void *buffer, size_t count);
+
int AXIS2_CALL
-axis2_stream_get_len_file(axis2_stream_t *stream, const axis2_env_t *env);
+axis2_stream_get_len_file(axis2_stream_t *stream,
+ const axis2_env_t *env);
int AXIS2_CALL
-axis2_stream_skip_file(axis2_stream_t *stream, const axis2_env_t *env, int count);
+axis2_stream_skip_file(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ int count);
/** socket stream operations **/
int AXIS2_CALL
-axis2_stream_write_socket(axis2_stream_t *stream, const axis2_env_t *env,
- const void *buffer, size_t count);
+axis2_stream_write_socket(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ const void *buffer, size_t count);
+
int AXIS2_CALL
-axis2_stream_read_socket(axis2_stream_t *stream, const axis2_env_t *env,
- void *buffer, size_t count);
+axis2_stream_read_socket(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ void *buffer, size_t count);
+
int AXIS2_CALL
-axis2_stream_get_len_socket(axis2_stream_t *stream, const axis2_env_t *env);
+axis2_stream_get_len_socket(axis2_stream_t *stream,
+ const axis2_env_t *env);
int AXIS2_CALL
-axis2_stream_skip_socket(axis2_stream_t *stream, const axis2_env_t *env, int count);
+axis2_stream_skip_socket(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ int count);
/************************* End of function headers ****************************/
/*
@@ -100,9 +122,9 @@
AXIS2_ENV_CHECK(env, NULL);
stream_impl = (axis2_stream_impl_t *)AXIS2_MALLOC(
- env->allocator, sizeof(axis2_stream_impl_t));
+ env->allocator, sizeof(axis2_stream_impl_t));
- if (NULL == stream_impl)
+ if (!stream_impl)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
@@ -112,7 +134,7 @@
stream_impl->fp = NULL;
stream_impl->socket = -1;
stream_impl->stream.ops = (axis2_stream_ops_t *) AXIS2_MALLOC(
- env->allocator, sizeof(axis2_stream_ops_t));
+ env->allocator, sizeof(axis2_stream_ops_t));
if (NULL == stream_impl->stream.ops)
{
axis2_stream_free(&(stream_impl->stream), env);
@@ -128,7 +150,8 @@
axis2_status_t AXIS2_CALL
-axis2_stream_free(axis2_stream_t *stream, const axis2_env_t *env)
+axis2_stream_free(axis2_stream_t *stream,
+ const axis2_env_t *env)
{
axis2_stream_impl_t *stream_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -143,7 +166,6 @@
{
AXIS2_FREE(env->allocator, stream_impl->buffer_head);
}
- stream_impl->buffer_head = NULL;
stream_impl->buffer = NULL;
stream_impl->len = -1;
break;
@@ -179,7 +201,7 @@
axis2_status_t AXIS2_CALL
axis2_stream_free_void_arg(void *stream,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
axis2_stream_t *stream_l = NULL;
@@ -197,7 +219,7 @@
AXIS2_ENV_CHECK(env, NULL);
def_stream = axis2_stream_create_internal(env);
- if (NULL == def_stream)
+ if (!def_stream)
{
/*
* We leave the error returned by the
@@ -212,12 +234,12 @@
stream_impl->stream.ops->get_len = axis2_stream_get_len_basic;
stream_impl->stream.ops->skip = axis2_stream_skip_basic;
stream_impl->buffer = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
- AXIS2_STREAM_DEFAULT_BUF_SIZE * sizeof(axis2_char_t));
+ AXIS2_STREAM_DEFAULT_BUF_SIZE * sizeof(axis2_char_t));
stream_impl->buffer_head = stream_impl->buffer;
stream_impl->len = 0;
stream_impl->max_len = AXIS2_STREAM_DEFAULT_BUF_SIZE;
- if (NULL == stream_impl->buffer)
+ if (!stream_impl->buffer)
{
axis2_stream_free(def_stream, env);
return NULL;
@@ -228,7 +250,7 @@
int AXIS2_CALL
axis2_stream_read_basic(axis2_stream_t *stream, const axis2_env_t *env,
- void *buffer, size_t count)
+ void *buffer, size_t count)
{
int len = 0;
char *buf = NULL;
@@ -236,11 +258,11 @@
AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
buf = AXIS2_INTF_TO_IMPL(stream)->buffer;
- if (NULL == buf)
+ if (!buf)
{
return -1;
}
- if (NULL == buffer)
+ if (!buffer)
{
return -1;
}
@@ -264,14 +286,15 @@
}
int AXIS2_CALL
-axis2_stream_write_basic(axis2_stream_t *stream, const axis2_env_t *env,
- const void *buffer, size_t count)
+axis2_stream_write_basic(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ const void *buffer, size_t count)
{
axis2_stream_impl_t *stream_impl = NULL;
int new_len = 0;
AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
- if (NULL == buffer)
+ if (!buffer)
return -1;
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[axis2_stream_write_basic] %s %d",(char*)buffer, count);
@@ -281,12 +304,12 @@
if (new_len > stream_impl->max_len)
{
axis2_char_t *tmp = (axis2_char_t *)AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * (new_len +
- AXIS2_STREAM_DEFAULT_BUF_SIZE));
- if (NULL == tmp)
+ sizeof(axis2_char_t) * (new_len +
+ AXIS2_STREAM_DEFAULT_BUF_SIZE));
+ if (!tmp)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
- AXIS2_FAILURE);
+ AXIS2_FAILURE);
return -1;
}
/*
@@ -300,21 +323,23 @@
stream_impl->buffer_head = tmp;
}
memcpy(stream_impl->buffer + (stream_impl->len * sizeof(axis2_char_t)),
- buffer, count);
+ buffer, count);
stream_impl->len += count;
return count;
}
int AXIS2_CALL
-axis2_stream_get_len_basic(axis2_stream_t *stream, const axis2_env_t *env)
+axis2_stream_get_len_basic(axis2_stream_t *stream,
+ const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
return AXIS2_INTF_TO_IMPL(stream)->len;
}
int AXIS2_CALL
-axis2_stream_skip_basic(axis2_stream_t *stream, const axis2_env_t *env, int count)
+axis2_stream_skip_basic(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ int count)
{
axis2_stream_impl_t *stream_impl = NULL;
int del_len = 0;
@@ -342,13 +367,12 @@
axis2_stream_get_buffer (const axis2_stream_t *stream,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
return AXIS2_INTF_TO_IMPL(stream)->buffer;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_stream_flush_buffer (const axis2_stream_t *stream,
- const axis2_env_t *env)
+ const axis2_env_t *env)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_INTF_TO_IMPL(stream)->len = 0;
@@ -367,7 +391,7 @@
AXIS2_ENV_CHECK(env, NULL);
def_stream = axis2_stream_create_internal(env);
- if (NULL == def_stream)
+ if (!def_stream)
{
/*
* We leave the error returned by the
@@ -389,19 +413,20 @@
int AXIS2_CALL
-axis2_stream_read_file(axis2_stream_t *stream, const axis2_env_t *env,
- void *buffer, size_t count)
+axis2_stream_read_file(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ void *buffer, size_t count)
{
FILE *fp = NULL;
AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
- if (NULL == AXIS2_INTF_TO_IMPL(stream)->fp)
+ if (!AXIS2_INTF_TO_IMPL(stream)->fp)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_FD, AXIS2_FAILURE);
return -1;
}
fp = AXIS2_INTF_TO_IMPL(stream)->fp;
- if (NULL == buffer)
+ if (!buffer)
{
return -1;
}
@@ -409,20 +434,21 @@
}
int AXIS2_CALL
-axis2_stream_write_file(axis2_stream_t *stream, const axis2_env_t *env,
- const void *buffer, size_t count)
+axis2_stream_write_file(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ const void *buffer, size_t count)
{
int len = 0;
FILE *fp = NULL;
- if (NULL == AXIS2_INTF_TO_IMPL(stream)->fp)
+ if (!AXIS2_INTF_TO_IMPL(stream)->fp)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_FD, AXIS2_FAILURE);
return -1;
}
fp = AXIS2_INTF_TO_IMPL(stream)->fp;
AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
- if (NULL == buffer)
+ if (!buffer)
return -1;
len = fwrite(buffer, sizeof(axis2_char_t), count, fp);
return len;
@@ -430,20 +456,22 @@
int AXIS2_CALL
-axis2_stream_get_len_file(axis2_stream_t *stream, const axis2_env_t *env)
+axis2_stream_get_len_file(axis2_stream_t *stream,
+ const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
return -1;
}
int AXIS2_CALL
-axis2_stream_skip_file(axis2_stream_t *stream, const axis2_env_t *env, int count)
+axis2_stream_skip_file(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ int count)
{
axis2_stream_impl_t *stream_impl = NULL;
int c = -1;
int i = count;
AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
- if (NULL == AXIS2_INTF_TO_IMPL(stream)->fp)
+ if (!AXIS2_INTF_TO_IMPL(stream)->fp)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_FD, AXIS2_FAILURE);
return -1;
@@ -459,14 +487,15 @@
/************************** Socket Stream Operations **************************/
AXIS2_EXTERN axis2_stream_t * AXIS2_CALL
-axis2_stream_create_socket(const axis2_env_t *env, int socket)
+axis2_stream_create_socket(const axis2_env_t *env,
+ int socket)
{
axis2_stream_t *def_stream = NULL;
axis2_stream_impl_t *stream_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
def_stream = axis2_stream_create_internal(env);
- if (NULL == def_stream)
+ if (!def_stream)
{
/*
* We leave the error returned by the
@@ -490,8 +519,9 @@
int AXIS2_CALL
-axis2_stream_read_socket(axis2_stream_t *stream, const axis2_env_t *env,
- void *buffer, size_t count)
+axis2_stream_read_socket(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ void *buffer, size_t count)
{
int len = 0;
#ifdef AXIS2_TCPMON
@@ -503,10 +533,10 @@
if (-1 == AXIS2_INTF_TO_IMPL(stream)->socket)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET,
- AXIS2_FAILURE);
+ AXIS2_FAILURE);
return -1;
}
- if (NULL == buffer)
+ if (!buffer)
{
return -1;
}
@@ -517,14 +547,13 @@
if (len > 1)
{
temp = (axis2_char_t *)AXIS2_MALLOC(env->allocator,
- (len + 1) * sizeof(axis2_char_t));
+ (len + 1) * sizeof(axis2_char_t));
if (temp)
{
memcpy(temp, buffer, len * sizeof(axis2_char_t));
temp[len] = '\0';
fprintf(stderr, "%s", temp);
AXIS2_FREE(env->allocator, temp);
- temp = NULL;
}
}
#endif
@@ -532,8 +561,9 @@
}
int AXIS2_CALL
-axis2_stream_write_socket(axis2_stream_t *stream, const axis2_env_t *env,
- const void *buffer, size_t count)
+axis2_stream_write_socket(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ const void *buffer, size_t count)
{
int len = 0;
#ifdef AXIS2_TCPMON
@@ -545,24 +575,23 @@
if (-1 == AXIS2_INTF_TO_IMPL(stream)->socket)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET,
- AXIS2_FAILURE);
+ AXIS2_FAILURE);
return -1;
}
- if (NULL == buffer)
+ if (!buffer)
return -1;
len = send(AXIS2_INTF_TO_IMPL(stream)->socket, buffer, count, 0);
#ifdef AXIS2_TCPMON
if (len > 0)
{
temp = (axis2_char_t *)AXIS2_MALLOC(env->allocator,
- (len + 1) * sizeof(axis2_char_t));
+ (len + 1) * sizeof(axis2_char_t));
if (temp)
{
memcpy(temp, buffer, len * sizeof(axis2_char_t));
temp[len] = '\0';
fprintf(stderr, "%s", temp);
AXIS2_FREE(env->allocator, temp);
- temp = NULL;
}
}
#endif
@@ -572,14 +601,16 @@
int AXIS2_CALL
-axis2_stream_get_len_socket(axis2_stream_t *stream, const axis2_env_t *env)
+axis2_stream_get_len_socket(axis2_stream_t *stream,
+ const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
return -1;
}
int AXIS2_CALL
-axis2_stream_skip_socket(axis2_stream_t *stream, const axis2_env_t *env, int count)
+axis2_stream_skip_socket(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ int count)
{
int len = 0;
char buffer[2];
@@ -600,8 +631,9 @@
}
AXIS2_EXTERN int AXIS2_CALL
-axis2_stream_peek_socket(axis2_stream_t *stream, const axis2_env_t *env,
- void *buffer, size_t count)
+axis2_stream_peek_socket(axis2_stream_t *stream,
+ const axis2_env_t *env,
+ void *buffer, size_t count)
{
int len = 0;
@@ -610,10 +642,10 @@
if (-1 == AXIS2_INTF_TO_IMPL(stream)->socket)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET,
- AXIS2_FAILURE);
+ AXIS2_FAILURE);
return -1;
}
- if (NULL == buffer)
+ if (!buffer)
{
return -1;
}
Modified: webservices/axis2/trunk/c/util/src/string.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/string.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/string.c (original)
+++ webservices/axis2/trunk/c/util/src/string.c Sat Mar 17 01:12:54 2007
@@ -45,7 +45,7 @@
}
string = (axis2_string_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_string_t));
+ sizeof(axis2_string_t));
if (!string)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -67,7 +67,7 @@
}
string->buffer = (axis2_char_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * (string->length + 1));
+ sizeof(axis2_char_t) * (string->length + 1));
if (!(string->buffer))
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -134,7 +134,7 @@
}
string = (axis2_string_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_string_t));
+ sizeof(axis2_string_t));
if (!string)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -164,17 +164,20 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
if (!string)
+ {
return AXIS2_FAILURE;
+ }
string->ref_count--;
if (string->ref_count > 0)
+ {
return AXIS2_SUCCESS;
+ }
if (string->owns_buffer && string->buffer)
{
AXIS2_FREE(env->allocator, string->buffer);
- string->buffer = NULL;
}
AXIS2_FREE(env->allocator, string);
@@ -189,7 +192,9 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
if (!string || !string1)
+ {
return AXIS2_FALSE;
+ }
return (string->buffer == string1->buffer);
}
@@ -201,7 +206,9 @@
AXIS2_ENV_CHECK(env, NULL);
if (!string)
+ {
return NULL;
+ }
string->ref_count++;
@@ -212,10 +219,10 @@
axis2_string_get_buffer(const struct axis2_string *string,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
-
if (!string)
+ {
return NULL;
+ }
return string->buffer;
}
@@ -224,10 +231,10 @@
axis2_string_get_length(const struct axis2_string *string,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
-
if (!string)
+ {
return -1;
+ }
return string->length;
}
@@ -239,14 +246,15 @@
#define MAX_SAVED_LENGTHS 6
AXIS2_EXTERN void* AXIS2_CALL
-axis2_strdup(const void *ptr, const axis2_env_t *env)
+axis2_strdup(const void *ptr,
+ const axis2_env_t *env)
{
AXIS2_ENV_CHECK(env, NULL);
if (ptr)
{
int len = axis2_strlen(ptr);
axis2_char_t * str = (axis2_char_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * (len + 1));
+ sizeof(axis2_char_t) * (len + 1));
if (!str)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -263,8 +271,8 @@
AXIS2_EXTERN void * AXIS2_CALL
axis2_strmemdup(const void *ptr,
- size_t n,
- const axis2_env_t *env)
+ size_t n,
+ const axis2_env_t *env)
{
axis2_char_t *str;
@@ -272,7 +280,7 @@
AXIS2_PARAM_CHECK(env->error, ptr, NULL);
str = (axis2_char_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * (n + 1));
+ sizeof(axis2_char_t) * (n + 1));
if (!str)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -285,8 +293,7 @@
}
AXIS2_EXTERN void * AXIS2_CALL
-axis2_memchr(
- const void *ptr,
+axis2_memchr(const void *ptr,
int c,
size_t n)
{
@@ -302,8 +309,7 @@
}
AXIS2_EXTERN void* AXIS2_CALL
-axis2_strndup(
- const void *ptr,
+axis2_strndup(const void *ptr,
int n,
const axis2_env_t *env)
{
@@ -317,7 +323,7 @@
if (end)
n = end - (axis2_char_t *) ptr;
str = (axis2_char_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * (n + 1));
+ sizeof(axis2_char_t) * (n + 1));
if (!str)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -330,8 +336,7 @@
}
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
-axis2_strcat(
- const axis2_env_t *env, ...)
+axis2_strcat(const axis2_env_t *env, ...)
{
axis2_char_t *cp, *argp, *str;
size_t saved_lengths[MAX_SAVED_LENGTHS];
@@ -396,31 +401,33 @@
}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axis2_stracat(const axis2_char_t *s1, const axis2_char_t *s2, const axis2_env_t *env)
+axis2_stracat(const axis2_char_t *s1,
+ const axis2_char_t *s2,
+ const axis2_env_t *env)
{
axis2_char_t *ret = NULL;
int alloc_len = -1;
int len1 = 0;
int len2 = 0;
- if (NULL == s1 && NULL == s2)
+ if (!s1 && !s2)
{
return NULL;
}
- if (NULL == s1)
+ if (!s1)
{
- return (axis2_char_t*)AXIS2_STRDUP(s2, env);
+ return (axis2_char_t*)axis2_strdup(s2, env);
}
- if (NULL == s2)
+ if (!s2)
{
- return (axis2_char_t*)AXIS2_STRDUP(s1, env);
+ return (axis2_char_t*)axis2_strdup(s1, env);
}
len1 = axis2_strlen(s1);
len2 = axis2_strlen(s2);
alloc_len = len1 + len2 + 1;
ret = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
- alloc_len * sizeof(axis2_char_t));
+ alloc_len * sizeof(axis2_char_t));
memcpy(ret, s1, len1 * sizeof(axis2_char_t));
memcpy((ret + len1 * sizeof(axis2_char_t)), s2,
len2 * sizeof(axis2_char_t));
@@ -429,22 +436,33 @@
}
AXIS2_EXTERN int AXIS2_CALL
-axis2_strcmp(const axis2_char_t * s1, const axis2_char_t * s2)
+axis2_strcmp(const axis2_char_t * s1,
+ const axis2_char_t * s2)
{
if (s1 && s2)
+ {
return strcmp(s1, s2);
+ }
else
+ {
return -1;
+ }
}
AXIS2_EXTERN int AXIS2_CALL
-axis2_strncmp(const axis2_char_t * s1, const axis2_char_t * s2, int n)
+axis2_strncmp(const axis2_char_t * s1,
+ const axis2_char_t * s2,
+ int n)
{
if (s1 && s2)
+ {
return strncmp(s1, s2, n);
+ }
else
+ {
return -1;
+ }
}
@@ -452,80 +470,104 @@
axis2_strlen(const axis2_char_t * s)
{
if (s)
+ {
return strlen(s);
+ }
else
+ {
return -1;
+ }
}
AXIS2_EXTERN int AXIS2_CALL
-axis2_strcasecmp(const axis2_char_t *s1, const axis2_char_t *s2)
+axis2_strcasecmp(const axis2_char_t *s1,
+ const axis2_char_t *s2)
{
- while (*s1 != '\0' && *s2 != '\0'){
- if(*s1 >= 'A' && *s1 <= 'Z' && *s2 >= 'a' && *s2 <= 'z'){
+ while (*s1 != '\0' && *s2 != '\0')
+ {
+ if(*s1 >= 'A' && *s1 <= 'Z' && *s2 >= 'a' && *s2 <= 'z')
+ {
if (*s2 - *s1 - (char)32 != 0){ return 1;}
}
- else if(*s1 >= 'a' && *s1 <= 'z' && *s2 >= 'A' && *s2 <= 'Z'){
+ else if(*s1 >= 'a' && *s1 <= 'z' && *s2 >= 'A' && *s2 <= 'Z')
+ {
if (*s1 - *s2 - 32 != 0) {return 1;}
}
else if (*s1 - *s2 != 0)
+ {
return 1;
-
+ }
s1++; s2++;
}
if (*s1 != *s2)
+ {
return 1;
+ }
return 0;
}
AXIS2_EXTERN int AXIS2_CALL
-axis2_strncasecmp(const axis2_char_t *s1, const axis2_char_t *s2, const int n)
+axis2_strncasecmp(const axis2_char_t *s1,
+ const axis2_char_t *s2,
+ const int n)
{
axis2_char_t *str1 = (axis2_char_t *)s1, *str2 = (axis2_char_t *)s2;
int i = (int)n;
while (--i >= 0 && toupper(*str1) == toupper(*str2++))
+ {
if (toupper(*str1++) == '\0')
+ {
return(0);
+ }
+ }
return(i < 0 ? 0 : toupper(*str1) - toupper(*--str2));
}
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
axis2_strstr(const axis2_char_t *heystack,
- const axis2_char_t *needle)
+ const axis2_char_t *needle)
{
return strstr(heystack, needle);
}
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
-axis2_rindex(const axis2_char_t *_s, axis2_char_t _ch)
+axis2_rindex(const axis2_char_t *_s,
+ axis2_char_t _ch)
{
int i, ilen = axis2_strlen(_s);
if (ilen < 1)
+ {
return NULL;
+ }
for (i = ilen - 1;i >= 0;i--)
{
if (_s[i] == _ch)
+ {
return (axis2_char_t *)(_s + i);
+ }
}
return NULL;
}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
axis2_replace(const axis2_env_t *env,
- axis2_char_t *str,
- int s1,
- int s2)
+ axis2_char_t *str,
+ int s1,
+ int s2)
{
axis2_char_t *newstr = NULL;
axis2_char_t *index = NULL;
if (!str)
+ {
return NULL;
+ }
- newstr = AXIS2_STRDUP(str, env);
+ newstr = axis2_strdup(str, env);
index = strchr(newstr, s1);
while (index)
@@ -537,8 +579,7 @@
}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axis2_strltrim(
- const axis2_env_t *env,
+axis2_strltrim(const axis2_env_t *env,
const axis2_char_t *_s,
const axis2_char_t *_trim)
{
@@ -546,16 +587,20 @@
axis2_char_t *ret = NULL;
if (!_s)
+ {
return NULL;
+ }
_p = (axis2_char_t *) _s;
if (!_trim)
+ {
_trim = " \t\r\n";
+ }
while (*_p)
{
if (!strchr(_trim, *_p))
{
- ret = (axis2_char_t *) AXIS2_STRDUP(_p, env);
+ ret = (axis2_char_t *) axis2_strdup(_p, env);
break;
}
++_p;
@@ -564,8 +609,7 @@
}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axis2_strrtrim(
- const axis2_env_t *env,
+axis2_strrtrim(const axis2_env_t *env,
const axis2_char_t *_s,
const axis2_char_t *_trim)
{
@@ -573,15 +617,19 @@
axis2_char_t *ret = NULL;
if (!_s)
+ {
return NULL;
+ }
__tail = ((axis2_char_t *) _s) + axis2_strlen(_s);
if (!_trim)
+ {
_trim = " \t\n\r";
+ }
while (_s < __tail--)
{
if (!strchr(_trim, *__tail))
{
- ret = (axis2_char_t *) AXIS2_STRDUP(_s, env);
+ ret = (axis2_char_t *) axis2_strdup(_s, env);
break;
}
*__tail = 0;
@@ -590,8 +638,7 @@
}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axis2_strtrim(
- const axis2_env_t *env,
+axis2_strtrim(const axis2_env_t *env,
const axis2_char_t *_s,
const axis2_char_t *_trim)
{
@@ -601,12 +648,16 @@
_p = axis2_strltrim(env, _s, _trim);
_q = axis2_strrtrim(env, _p, _trim);
if (_p)
+ {
AXIS2_FREE(env->allocator, _p);
+ }
return _q;
}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axis2_string_replace(axis2_char_t* str, axis2_char_t old, axis2_char_t new)
+axis2_string_replace(axis2_char_t* str,
+ axis2_char_t old,
+ axis2_char_t new)
{
axis2_char_t* str_returns = str;
for (; *str != '\0' ; str ++)
@@ -620,7 +671,8 @@
}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axis2_string_substring_starting_at(axis2_char_t* str, int s)
+axis2_string_substring_starting_at(axis2_char_t* str,
+ int s)
{
int len;
int pos_to_shift;
@@ -638,7 +690,8 @@
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axis2_string_substring_ending_at(axis2_char_t* str, int e)
+axis2_string_substring_ending_at(axis2_char_t* str,
+ int e)
{
axis2_char_t* ptr = NULL;
int length = 0;
@@ -678,13 +731,16 @@
}
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
-axis2_strcasestr(const axis2_char_t *heystack, const axis2_char_t *needle)
+axis2_strcasestr(const axis2_char_t *heystack,
+ const axis2_char_t *needle)
{
axis2_char_t start, current;
size_t len;
if (!heystack || !needle)
+ {
return NULL;
+ }
if ((start = *needle++))
{
@@ -694,7 +750,9 @@
do
{
if (!(current = *heystack++))
+ {
return NULL;
+ }
} while (toupper(current) != toupper(start));
} while (axis2_strncasecmp(heystack, needle, len));
heystack--;
Modified: webservices/axis2/trunk/c/util/src/string_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/string_util.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/string_util.c (original)
+++ webservices/axis2/trunk/c/util/src/string_util.c Sat Mar 17 01:12:54 2007
@@ -21,8 +21,8 @@
AXIS2_EXTERN axis2_array_list_t * AXIS2_CALL
axis2_tokenize(const axis2_env_t *env,
- axis2_char_t *in,
- int delim)
+ axis2_char_t *in,
+ int delim)
{
axis2_array_list_t *list = NULL;
axis2_char_t *rest = NULL;
@@ -30,18 +30,22 @@
axis2_char_t *index = NULL;
- if (!in || AXIS2_STRCMP(in, "") == 0)
+ if (!in || axis2_strcmp(in, "") == 0)
+ {
return NULL;
+ }
list = axis2_array_list_create(env, 10);
if (!list)
+ {
return NULL;
+ }
- str = AXIS2_STRDUP(in, env);
+ str = axis2_strdup(in, env);
do
{
index = strchr(str, delim);
- if ((index == NULL) && (str) && AXIS2_STRCMP(str, "") != 0)
+ if ((!index) && (str) && axis2_strcmp(str, "") != 0)
{
axis2_array_list_add(list, env, str);
break;
@@ -49,14 +53,16 @@
rest = index + 1;
str[index - str] = '\0';
- if ((list) && (NULL != str) && AXIS2_STRCMP(str, "") != 0)
+ if ((list) && (str) && axis2_strcmp(str, "") != 0)
{
axis2_array_list_add(list, env, str);
}
- if (!rest || AXIS2_STRCMP(rest, "") == 0)
+ if (!rest || axis2_strcmp(rest, "") == 0)
+ {
break;
+ }
str = rest;
rest = NULL;
index = NULL;
@@ -68,8 +74,8 @@
AXIS2_EXTERN axis2_array_list_t * AXIS2_CALL
axis2_first_token(const axis2_env_t *env,
- axis2_char_t *in,
- int delim)
+ axis2_char_t *in,
+ int delim)
{
axis2_array_list_t *list = NULL;
axis2_char_t *str = NULL;
@@ -77,21 +83,23 @@
axis2_char_t *index = NULL;
AXIS2_ENV_CHECK(env, NULL);
- if (!in && (AXIS2_STRCMP(in, "") == 0))
+ if (!in && (axis2_strcmp(in, "") == 0))
{
return NULL;
}
list = axis2_array_list_create(env, 2);
- if (NULL == list)
+ if (!list)
+ {
return NULL;
- str = AXIS2_STRDUP(in, env);
+ }
+ str = axis2_strdup(in, env);
index = strchr(str, delim);
- if (index == NULL)
+ if (!index)
{
axis2_array_list_add(list, env, str);
- axis2_array_list_add(list, env, AXIS2_STRDUP("", env));
+ axis2_array_list_add(list, env, axis2_strdup("", env));
return list;
}
@@ -105,8 +113,8 @@
AXIS2_EXTERN axis2_array_list_t * AXIS2_CALL
axis2_last_token(const axis2_env_t *env,
- axis2_char_t *in,
- int delim)
+ axis2_char_t *in,
+ int delim)
{
axis2_array_list_t *list = NULL;
axis2_char_t *str = NULL;
@@ -114,21 +122,23 @@
axis2_char_t *index = NULL;
AXIS2_ENV_CHECK(env, NULL);
- if (!in && (AXIS2_STRCMP(in, "") == 0))
+ if (!in && (axis2_strcmp(in, "") == 0))
{
return NULL;
}
list = axis2_array_list_create(env, 2);
- if (NULL == list)
+ if (!list)
+ {
return NULL;
+ }
- str = AXIS2_STRDUP(in, env);
- index = AXIS2_RINDEX(str, delim);
+ str = axis2_strdup(in, env);
+ index = axis2_rindex(str, delim);
- if (index == NULL)
+ if (!index)
{
- axis2_array_list_add(list, env, AXIS2_STRDUP("", env));
+ axis2_array_list_add(list, env, axis2_strdup("", env));
axis2_array_list_add(list, env, str);
return list;
}
Modified: webservices/axis2/trunk/c/util/src/thread_pool.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/thread_pool.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/thread_pool.c (original)
+++ webservices/axis2/trunk/c/util/src/thread_pool.c Sat Mar 17 01:12:54 2007
@@ -32,7 +32,7 @@
};
#define AXIS2_INTF_TO_IMPL(thread_pool) \
- ((axis2_thread_pool_impl_t *)(thread_pool))
+ ((axis2_thread_pool_impl_t *)(thread_pool))
/********************************Function headers******************************/
axis2_status_t AXIS2_CALL
@@ -40,19 +40,19 @@
axis2_thread_t* AXIS2_CALL
axis2_thread_pool_get_thread(axis2_thread_pool_t *pool,
- axis2_thread_start_t func, void *data);
+ axis2_thread_start_t func, void *data);
axis2_status_t AXIS2_CALL
axis2_thread_pool_join_thread(axis2_thread_pool_t *pool,
- axis2_thread_t *thd);
+ axis2_thread_t *thd);
axis2_status_t AXIS2_CALL
axis2_thread_pool_exit_thread(axis2_thread_pool_t *pool,
- axis2_thread_t *thd);
+ axis2_thread_t *thd);
axis2_status_t AXIS2_CALL
axis2_thread_pool_thread_detach(axis2_thread_pool_t *pool,
- axis2_thread_t *thd);
+ axis2_thread_t *thd);
/************************* End of function headers ****************************/
AXIS2_EXTERN axis2_thread_pool_t * AXIS2_CALL
@@ -61,16 +61,16 @@
axis2_thread_pool_impl_t *pool_impl = NULL;
pool_impl = (axis2_thread_pool_impl_t *)AXIS2_MALLOC(allocator,
- sizeof(axis2_thread_pool_impl_t));
+ sizeof(axis2_thread_pool_impl_t));
- if (NULL == pool_impl)
+ if (!pool_impl)
{
return NULL;
}
pool_impl->allocator = allocator;
pool_impl->thread_pool.ops = (axis2_thread_pool_ops_t *) AXIS2_MALLOC(
- allocator, sizeof(axis2_thread_pool_ops_t));
- if (NULL == pool_impl->thread_pool.ops)
+ allocator, sizeof(axis2_thread_pool_ops_t));
+ if (!pool_impl->thread_pool.ops)
{
axis2_thread_pool_free(&(pool_impl->thread_pool));
return NULL;
@@ -88,11 +88,11 @@
axis2_thread_pool_free(axis2_thread_pool_t *pool)
{
axis2_thread_pool_impl_t *pool_impl = AXIS2_INTF_TO_IMPL(pool);
- if (NULL == pool)
+ if (!pool)
{
return AXIS2_FAILURE;
}
- if (NULL == pool_impl->allocator)
+ if (!pool_impl->allocator)
{
return AXIS2_FAILURE;
}
@@ -107,14 +107,14 @@
axis2_thread_t* AXIS2_CALL
axis2_thread_pool_get_thread(axis2_thread_pool_t *pool,
- axis2_thread_start_t func, void *data)
+ axis2_thread_start_t func, void *data)
{
axis2_thread_pool_impl_t *pool_impl = AXIS2_INTF_TO_IMPL(pool);
- if (NULL == pool)
+ if (!pool)
{
return NULL;
}
- if (NULL == pool_impl->allocator)
+ if (!pool_impl->allocator)
{
return NULL;
}
@@ -124,9 +124,9 @@
axis2_status_t AXIS2_CALL
axis2_thread_pool_join_thread(axis2_thread_pool_t *pool,
- axis2_thread_t *thd)
+ axis2_thread_t *thd)
{
- if (NULL == pool || NULL == thd)
+ if (!pool || !thd)
{
return AXIS2_FAILURE;
}
@@ -135,10 +135,10 @@
axis2_status_t AXIS2_CALL
axis2_thread_pool_exit_thread(axis2_thread_pool_t *pool,
- axis2_thread_t *thd)
+ axis2_thread_t *thd)
{
axis2_thread_pool_impl_t *pool_impl = AXIS2_INTF_TO_IMPL(pool);
- if (NULL == pool || NULL == thd)
+ if (!pool || !thd)
{
return AXIS2_FAILURE;
}
@@ -148,9 +148,9 @@
axis2_status_t AXIS2_CALL
axis2_thread_pool_thread_detach(axis2_thread_pool_t *pool,
- axis2_thread_t *thd)
+ axis2_thread_t *thd)
{
- if (NULL == pool || NULL == thd)
+ if (!pool || !thd)
{
return AXIS2_FAILURE;
}
@@ -162,21 +162,22 @@
{
axis2_error_t *error = axis2_error_create(system_env->allocator);
return axis2_env_create_with_error_log_thread_pool(system_env->allocator, error,
- system_env->log, system_env->thread_pool);
+ system_env->log, system_env->thread_pool);
}
AXIS2_EXTERN void AXIS2_CALL
axis2_free_thread_env(struct axis2_env *thread_env)
{
if (!thread_env)
+ {
return;
+ }
/* log, thread_pool and allocator are shared, so do not free them */
thread_env->log = NULL;
thread_env->thread_pool = NULL;
if (thread_env->error)
{
AXIS2_ERROR_FREE(thread_env->error);
- thread_env->error = NULL;
}
AXIS2_FREE(thread_env->allocator, thread_env);
}
Modified: webservices/axis2/trunk/c/util/src/uri.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/uri.c?view=diff&rev=519261&r1=519260&r2=519261
==============================================================================
--- webservices/axis2/trunk/c/util/src/uri.c (original)
+++ webservices/axis2/trunk/c/util/src/uri.c Sat Mar 17 01:12:54 2007
@@ -65,7 +65,7 @@
/* Here is the hand-optimized parse_uri_components(). There are some wild
* tricks we could pull in assembly language that we don't pull here... like we
* can do word-at-time scans for delimiter characters using the same technique
- * that fast AXIS2_MEMCHR()s use. But that would be way non-portable. -djg
+ * that fast axis2_memchr()s use. But that would be way non-portable. -djg
*/
/* We have a axis2_table_t that we can index by character and it tells us if the
@@ -187,9 +187,9 @@
AXIS2_ENV_CHECK(env, NULL);
uri = (axis2_uri_t *)AXIS2_MALLOC(env->allocator,
- sizeof(axis2_uri_t));
+ sizeof(axis2_uri_t));
- if (NULL == uri)
+ if (!uri)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
@@ -337,7 +337,7 @@
}
if (s != uri_str)
{
- uri->path = AXIS2_STRMEMDUP(uri_str, s - uri_str, env);
+ uri->path = axis2_strmemdup(uri_str, s - uri_str, env);
}
if (*s == 0)
{
@@ -349,17 +349,17 @@
s1 = strchr(s, '#');
if (s1)
{
- uri->fragment = AXIS2_STRDUP(s1 + 1, env);
- uri->query = AXIS2_STRMEMDUP(s, s1 - s, env);
+ uri->fragment = axis2_strdup(s1 + 1, env);
+ uri->query = axis2_strmemdup(s, s1 - s, env);
}
else
{
- uri->query = AXIS2_STRDUP(s, env);
+ uri->query = axis2_strdup(s, env);
}
return uri;
}
/* otherwise it's a fragment */
- uri->fragment = AXIS2_STRDUP(s + 1, env);
+ uri->fragment = axis2_strdup(s + 1, env);
return uri;
}
@@ -376,7 +376,7 @@
goto deal_with_path; /* backwards predicted taken! */
}
- uri->scheme = AXIS2_STRMEMDUP(uri_str, s - uri_str, env);
+ uri->scheme = axis2_strmemdup(uri_str, s - uri_str, env);
s += 3;
deal_with_authority:
@@ -386,7 +386,7 @@
++s;
}
uri_str = s; /* whatever follows hostinfo is start of uri */
- uri->hostinfo = AXIS2_STRMEMDUP(hostinfo, uri_str - hostinfo, env);
+ uri->hostinfo = axis2_strmemdup(hostinfo, uri_str - hostinfo, env);
/* If there's a username:password@host:port, the @ we want is the last @...
* too bad there's no memrchr()... For the C purists, note that hostinfo
@@ -410,8 +410,8 @@
{
v6_offset1 = 1;
v6_offset2 = 2;
- s = AXIS2_MEMCHR(hostinfo, ']', uri_str - hostinfo);
- if (s == NULL)
+ s = axis2_memchr(hostinfo, ']', uri_str - hostinfo);
+ if (!s)
{
return NULL;
}
@@ -422,21 +422,20 @@
}
else
{
- s = AXIS2_MEMCHR(hostinfo, ':', uri_str - hostinfo);
+ s = axis2_memchr(hostinfo, ':', uri_str - hostinfo);
}
- if (s == NULL)
+ if (!s)
{
/* we expect the common case to have no port */
- uri->hostname = AXIS2_STRMEMDUP(
- hostinfo + v6_offset1,
- uri_str - hostinfo - v6_offset2, env);
+ uri->hostname = axis2_strmemdup(hostinfo + v6_offset1,
+ uri_str - hostinfo - v6_offset2, env);
goto deal_with_path;
}
- uri->hostname = AXIS2_STRMEMDUP(
- hostinfo + v6_offset1,
- s - hostinfo - v6_offset2, env);
+ uri->hostname = axis2_strmemdup(
+ hostinfo + v6_offset1,
+ s - hostinfo - v6_offset2, env);
++s;
- uri->port_str = AXIS2_STRMEMDUP(s, uri_str - s, env);
+ uri->port_str = axis2_strmemdup(s, uri_str - s, env);
if (uri_str != s)
{
port = strtol(uri->port_str, &endstr, 10);
@@ -453,16 +452,16 @@
}
/* first colon delimits username:password */
- s1 = AXIS2_MEMCHR(hostinfo, ':', s - hostinfo);
+ s1 = axis2_memchr(hostinfo, ':', s - hostinfo);
if (s1)
{
- uri->user = AXIS2_STRMEMDUP(hostinfo, s1 - hostinfo, env);
+ uri->user = axis2_strmemdup(hostinfo, s1 - hostinfo, env);
++s1;
- uri->password = AXIS2_STRMEMDUP(s1, s - s1, env);
+ uri->password = axis2_strmemdup(s1, s - s1, env);
}
else
{
- uri->user = AXIS2_STRMEMDUP(hostinfo, s - hostinfo, env);
+ uri->user = axis2_strmemdup(hostinfo, s - hostinfo, env);
}
hostinfo = s + 1;
goto deal_with_host;
@@ -495,15 +494,15 @@
*/
memset(uri, '\0', sizeof(*uri));
uri->is_initialized = 1;
- uri->hostinfo = AXIS2_STRDUP(hostinfo, env);
+ uri->hostinfo = axis2_strdup(hostinfo, env);
/* We expect hostinfo to point to the first character of
* the hostname. There must be a port, separated by a colon
*/
if (*hostinfo == '[')
{
- if ((rsb = strchr(hostinfo, ']')) == NULL ||
- *(rsb + 1) != ':')
+ if (!(rsb = strchr(hostinfo, ']')) ||
+ *(rsb + 1) != ':')
{
return NULL;
}
@@ -516,13 +515,13 @@
{
s = strchr(hostinfo, ':');
}
- if (s == NULL)
+ if (!s)
{
return NULL;
}
- uri->hostname = AXIS2_STRNDUP(hostinfo, s - hostinfo - v6_offset1, env);
+ uri->hostname = axis2_strndup(hostinfo, s - hostinfo - v6_offset1, env);
++s;
- uri->port_str = AXIS2_STRDUP(s, env);
+ uri->port_str = axis2_strdup(s, env);
if (*s != '\0')
{
uri->port = (unsigned short) strtol(uri->port_str, &endstr, 10);
@@ -545,25 +544,25 @@
AXIS2_PARAM_CHECK(env->error, base, NULL);
AXIS2_PARAM_CHECK(env->error, uri, NULL);
- if (uri == NULL || base == NULL || ! base->is_initialized
- || ! uri->is_initialized)
+ if (!uri || !base || ! base->is_initialized
+ || ! uri->is_initialized)
{
return NULL;
}
/* The interesting bit is the path. */
- if (uri->path == NULL)
+ if (!uri->path)
{
- if (uri->hostname == NULL)
+ if (!uri->hostname)
{
/* is this compatible with is_initialised? Harmless in any case */
- uri->path = base->path ? base->path : AXIS2_STRDUP("/", env) ;
+ uri->path = base->path ? base->path : axis2_strdup("/", env) ;
}
else
{
/* deal with the idiosyncracy of APR allowing path==NULL
* without risk of breaking back-compatibility
*/
- uri->path = AXIS2_STRDUP("/", env) ;
+ uri->path = axis2_strdup("/", env) ;
}
}
else if (uri->path[0] != '/')
@@ -602,31 +601,31 @@
}
/* The trivial bits are everything-but-path */
- if (uri->scheme == NULL)
+ if (!uri->scheme)
{
- uri->scheme = AXIS2_STRDUP(base->scheme, env) ;
+ uri->scheme = axis2_strdup(base->scheme, env) ;
}
- if (uri->hostinfo == NULL)
+ if (!uri->hostinfo)
{
- uri->hostinfo = AXIS2_STRDUP(base->hostinfo, env) ;
+ uri->hostinfo = axis2_strdup(base->hostinfo, env) ;
}
- if (uri->user == NULL)
+ if (!uri->user)
{
- uri->user = AXIS2_STRDUP(base->user, env) ;
+ uri->user = axis2_strdup(base->user, env) ;
}
- if (uri->password == NULL)
+ if (!uri->password)
{
- uri->password = AXIS2_STRDUP(base->password, env) ;
+ uri->password = axis2_strdup(base->password, env) ;
}
- if (uri->hostname == NULL)
+ if (!uri->hostname)
{
- uri->hostname = AXIS2_STRDUP(base->hostname, env) ;
+ uri->hostname = axis2_strdup(base->hostname, env) ;
}
- if (uri->port_str == NULL)
+ if (!uri->port_str)
{
- uri->port_str = AXIS2_STRDUP(base->port_str, env) ;
+ uri->port_str = axis2_strdup(base->port_str, env) ;
}
- if (uri->hostent == NULL)
+ if (!uri->hostent)
{
uri->hostent = base->hostent ;
}
@@ -663,7 +662,7 @@
{
for (scheme = schemes; scheme->name ; ++scheme)
{
- if (AXIS2_STRCASECMP(scheme_str, scheme->name) == 0)
+ if (axis2_strcasecmp(scheme_str, scheme->name) == 0)
{
return scheme->default_port;
}
@@ -681,15 +680,15 @@
AXIS2_ENV_CHECK(env, NULL);
new_uri = (axis2_uri_t *) axis2_uri_create(env);
- new_uri->scheme = AXIS2_STRDUP(uri->scheme, env);
- new_uri->hostinfo = AXIS2_STRDUP(uri->hostinfo, env);
- new_uri->user = AXIS2_STRDUP(uri->user, env);
- new_uri->password = AXIS2_STRDUP(uri->password, env);
- new_uri->hostname = AXIS2_STRDUP(uri->hostname, env);
- new_uri->port_str = AXIS2_STRDUP(uri->port_str, env);
- new_uri->path = AXIS2_STRDUP(uri->path, env);
- new_uri->query = AXIS2_STRDUP(uri->query, env);
- new_uri->fragment = AXIS2_STRDUP(uri->fragment, env);
+ new_uri->scheme = axis2_strdup(uri->scheme, env);
+ new_uri->hostinfo = axis2_strdup(uri->hostinfo, env);
+ new_uri->user = axis2_strdup(uri->user, env);
+ new_uri->password = axis2_strdup(uri->password, env);
+ new_uri->hostname = axis2_strdup(uri->hostname, env);
+ new_uri->port_str = axis2_strdup(uri->port_str, env);
+ new_uri->path = axis2_strdup(uri->path, env);
+ new_uri->query = axis2_strdup(uri->query, env);
+ new_uri->fragment = axis2_strdup(uri->fragment, env);
new_uri->hostent = uri->hostent;
new_uri->port = uri->port;
new_uri->is_initialized = uri->is_initialized;
@@ -719,18 +718,18 @@
if (uri->user || uri->password)
{
ret = axis2_strcat(env,
- (uri->user && !(flags & AXIS2_URI_UNP_OMITUSER))
- ? uri->user : "",
- (uri->password && !(flags & AXIS2_URI_UNP_OMITPASSWORD))
- ? ":" : "",
- (uri->password && !(flags & AXIS2_URI_UNP_OMITPASSWORD))
- ? ((flags & AXIS2_URI_UNP_REVEALPASSWORD)
- ? uri->password : "XXXXXXXX")
- : "",
- ((uri->user && !(flags & AXIS2_URI_UNP_OMITUSER)) ||
- (uri->password && !(flags & AXIS2_URI_UNP_OMITPASSWORD)))
- ? "@" : "",
- NULL);
+ (uri->user && !(flags & AXIS2_URI_UNP_OMITUSER))
+ ? uri->user : "",
+ (uri->password && !(flags & AXIS2_URI_UNP_OMITPASSWORD))
+ ? ":" : "",
+ (uri->password && !(flags & AXIS2_URI_UNP_OMITPASSWORD))
+ ? ((flags & AXIS2_URI_UNP_REVEALPASSWORD)
+ ? uri->password : "XXXXXXXX")
+ : "",
+ ((uri->user && !(flags & AXIS2_URI_UNP_OMITUSER)) ||
+ (uri->password && !(flags & AXIS2_URI_UNP_OMITPASSWORD)))
+ ? "@" : "",
+ NULL);
}
/* Construct scheme://site string */
@@ -747,17 +746,17 @@
is_default_port =
(uri->port_str == NULL ||
- uri->port == 0 ||
- uri->port == axis2_uri_port_of_scheme(uri->scheme));
+ uri->port == 0 ||
+ uri->port == axis2_uri_port_of_scheme(uri->scheme));
if (uri->scheme)
{
ret = axis2_strcat(env,
- uri->scheme, "://", ret,
- lbrk, uri->hostname, rbrk,
- is_default_port ? "" : ":",
- is_default_port ? "" : uri->port_str,
- NULL);
+ uri->scheme, "://", ret,
+ lbrk, uri->hostname, rbrk,
+ is_default_port ? "" : ":",
+ is_default_port ? "" : uri->port_str,
+ NULL);
}
else
{
@@ -767,10 +766,10 @@
* omitting the "scheme:" that the user neglected to pass us.
*/
ret = axis2_strcat(env,
- "//", ret, lbrk, uri->hostname, rbrk,
- is_default_port ? "" : ":",
- is_default_port ? "" : uri->port_str,
- NULL);
+ "//", ret, lbrk, uri->hostname, rbrk,
+ is_default_port ? "" : ":",
+ is_default_port ? "" : uri->port_str,
+ NULL);
}
}
}
@@ -780,18 +779,18 @@
{
/* Append path, query and fragment strings: */
ret = axis2_strcat(env,
- ret,
- (uri->path)
- ? uri->path : "",
- (uri->query && !(flags & AXIS2_URI_UNP_OMITQUERY))
- ? "?" : "",
- (uri->query && !(flags & AXIS2_URI_UNP_OMITQUERY))
- ? uri->query : "",
- (uri->fragment && !(flags & AXIS2_URI_UNP_OMITQUERY))
- ? "#" : NULL,
- (uri->fragment && !(flags & AXIS2_URI_UNP_OMITQUERY))
- ? uri->fragment : NULL,
- NULL);
+ ret,
+ (uri->path)
+ ? uri->path : "",
+ (uri->query && !(flags & AXIS2_URI_UNP_OMITQUERY))
+ ? "?" : "",
+ (uri->query && !(flags & AXIS2_URI_UNP_OMITQUERY))
+ ? uri->query : "",
+ (uri->fragment && !(flags & AXIS2_URI_UNP_OMITQUERY))
+ ? "#" : NULL,
+ (uri->fragment && !(flags & AXIS2_URI_UNP_OMITQUERY))
+ ? uri->fragment : NULL,
+ NULL);
}
return ret;
}
@@ -800,7 +799,6 @@
axis2_uri_get_protocol(axis2_uri_t *uri,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
return uri->scheme;
}
@@ -808,7 +806,6 @@
axis2_uri_get_server(axis2_uri_t *uri,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
return uri->hostinfo;
}
@@ -816,7 +813,6 @@
axis2_uri_get_port(axis2_uri_t *uri,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
return uri->port;
}
@@ -824,7 +820,6 @@
axis2_uri_get_path(axis2_uri_t *uri,
const axis2_env_t *env)
{
- AXIS2_ENV_CHECK(env, NULL);
return uri->path;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org