axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damitha Kumarage <damith...@gmail.com>
Subject Fixing AXIS2C-40
Date Wed, 01 Feb 2006 10:31:04 GMT
Hi
I have given a solution to
http://issues.apache.org/jira/browse/AXIS2C-40

I changed param_free method to look like following

axis2_status_t AXIS2_CALL
axis2_param_free(axis2_param_t *param,
                        axis2_env_t **env)
{
    void *param_value = NULL;

    AXIS2_FUNC_PARAM_CHECK(param, env, AXIS2_FAILURE);

    param_value = AXIS2_PARAM_GET_VALUE(param, env);
    if(param_value)
    {
        if(param->ops && param->ops->value_free)
        {
            param->ops->value_free(param_value, env);
        }
        else /* we assume that param value is axis2_char_t* */
        {
            AXIS2_FREE((*env)->allocator, param_value);
        }
    }
    AXIS2_FREE((*env)->allocator, param->ops);
    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(param));
    return AXIS2_SUCCESS;
}

Now param_container.h has the following function pointer type

/**
 * each type which is passed as a param value to a parameter, must have this
 * type of function implemented. When the param value is set this function
 * should also be assigned to param free function
 */
typedef axis2_status_t (*AXIS2_PARAM_VALUE_FREE) (void *param, 
axis2_env_t **env);

Now suppose we set the axis2_dll_desc_t type struct as a param value. We 
need
to have a axis2_dll_desc_as_param_value_free function implemented in
dll_desc.c

axis2_status_t AXIS2_CALL
axis2_dll_desc_as_param_value_free (void *as_param_value,
                                    axis2_env_t **env)
{
    axis2_dll_desc_t *dll_desc = NULL;

    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
    dll_desc = (axis2_dll_desc_t *) as_param_value;
    return axis2_dll_desc_free(dll_desc, env);
}

Now we need to assign this to value_free function of param as callback when
value is assigned to parameter.

 status = AXIS2_PARAM_SET_VALUE(impl_info_param, env, dll_desc);
 impl_info_param->ops->value_free = axis2_dll_desc_as_param_value_free;

What I want to say here is that we need to implement the free function as in
dll_desc.c for all the types set as param values. Otherwise param value
is assumed to be axis2_char_t * in the param free function.

thanks
damitha



Mime
View raw message