Exemple #1
0
AXIS2_EXTERN neethi_exactlyone_t *AXIS2_CALL
neethi_exactlyone_create(
    const axutil_env_t *env)
{
    neethi_exactlyone_t *neethi_exactlyone = NULL;

    AXIS2_ENV_CHECK(env, NULL);

    neethi_exactlyone = (neethi_exactlyone_t *)AXIS2_MALLOC(env->allocator,
        sizeof(neethi_exactlyone_t));

    if(neethi_exactlyone == NULL)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
        return NULL;
    }
    neethi_exactlyone->policy_components = NULL;

    neethi_exactlyone->policy_components = axutil_array_list_create(env, 0);
    if(!(neethi_exactlyone->policy_components))
    {
        neethi_exactlyone_free(neethi_exactlyone, env);
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
        return NULL;
    }
    return neethi_exactlyone;
}
Exemple #2
0
AXIS2_EXTERN void AXIS2_CALL
neethi_operator_free(
    neethi_operator_t *neethi_operator,
    const axutil_env_t *env)
{
    if(neethi_operator)
    {
        if(--(neethi_operator->ref) > 0)
        {
            return;
        }

        if(neethi_operator->value)
        {
            switch(neethi_operator->type)
            {
                case OPERATOR_TYPE_POLICY:
                    neethi_policy_free((neethi_policy_t *)neethi_operator->value, env);
                    neethi_operator->value = NULL;
                    break;

                case OPERATOR_TYPE_ALL:
                    neethi_all_free((neethi_all_t *)neethi_operator->value, env);
                    neethi_operator->value = NULL;
                    break;

                case OPERATOR_TYPE_EXACTLYONE:
                    neethi_exactlyone_free((neethi_exactlyone_t *)neethi_operator-> value, env);
                    neethi_operator->value = NULL;
                    break;

                case OPERATOR_TYPE_REFERENCE:
                    neethi_reference_free((neethi_reference_t *)neethi_operator-> value, env);
                    neethi_operator->value = NULL;
                    break;

                case OPERATOR_TYPE_ASSERTION:
                    neethi_assertion_free((neethi_assertion_t *)neethi_operator-> value, env);
                    neethi_operator->value = NULL;
                    break;

                case OPERATOR_TYPE_UNKNOWN:
                    break;
            }
        }
        AXIS2_FREE(env->allocator, neethi_operator);
    }
    return;
}