Exemple #1
0
PEGASUS_EXPORT void PEGASUS_CMPIR_CDECL native_release_CMPIContext (
    CONST CMPIContext * ctx )
{
    struct native_context * c = (struct native_context *) ctx;

    if (c->mem_state == TOOL_MM_NO_ADD)
    {

        c->mem_state = TOOL_MM_ADD;
        tool_mm_add ( c );

        propertyFT.release ( c->entries );
    }
}
Exemple #2
0
static CMPIStatus __eft_release ( CMPIEnumeration * enumeration )
{
    struct native_enum * e = (struct native_enum *) enumeration;

    CMPIStatus rc = checkArgsReturnStatus(enumeration);

    if (rc.rc == CMPI_RC_OK && e->mem_state == TOOL_MM_NO_ADD)
    {
        tool_mm_add ( enumeration );
        return e->data->ft->release ( e->data );
    }

    return rc;
}
Exemple #3
0
void native_release_CMPIValue ( CMPIType type, CMPIValue * val )
{
    switch (type)
    {
        case CMPI_instance:
            CMRelease ( val->inst );
            break;

        case CMPI_ref:
            CMRelease ( val->ref );
            break;

        case CMPI_args:
            CMRelease ( val->args );
            break;

        case CMPI_filter:
            CMRelease ( val->filter );
            break;

        case CMPI_enumeration:
            CMRelease ( val->Enum );
            break;

        case CMPI_string:
            CMRelease ( val->string );
            break;

        case CMPI_chars:
            tool_mm_add ( val->chars );
            break;

        case CMPI_dateTime:
            CMRelease ( val->dateTime );
            break;

        case CMPI_charsptr:
            free (val->dataPtr.ptr);
            break;

        default:
            if (type & CMPI_ARRAY)
            {
                CMRelease ( val->array );
            }
    }
}
static CMPIStatus __eft_release ( CMPISelectExp * exp )
{
    struct native_selectexp * e = (struct native_selectexp *) exp;
    CMPIContext *ctx;
    CMPIBroker *broker;
    CMPIStatus rc = checkArgsReturnStatus(exp);

    if (rc.rc != CMPI_RC_OK)
    {
        return rc;
    }
    broker = tool_mm_get_broker ( (void**)&ctx);

    if (e->mem_state == TOOL_MM_NO_ADD)
    {
        rc = ( ( (NativeCMPIBrokerFT*)broker->bft) )->selExp_release (exp);
        if (rc.rc == CMPI_RC_OK)
        {
            tool_mm_add ( e );
        }
    }
    CMReturn ( CMPI_RC_OK );
}
Exemple #5
0
/**
    returns non-zero if already existant
*/
static int __addProperty (
    struct native_property ** prop,
    int mm_add,
    const char * name,
    CONST CMPIType type,
    CMPIValueState state,
    CONST CMPIValue * value )
{
    CMPIValue v;

    if (*prop == NULL)
    {
        struct native_property * tmp = *prop =
                                           (struct native_property *)
                                           tool_mm_alloc ( mm_add,
                                                   sizeof ( struct native_property ) );

        tmp->name = strdup ( name );

        if (mm_add == TOOL_MM_ADD) tool_mm_add ( tmp->name );

        tmp->type  = type;
        tmp->state = value ? state : CMPI_nullValue;
        if (type == CMPI_chars)
        {

            tmp->type = CMPI_string;
            v.string = native_new_CMPIString ( (char *) value, NULL );
            value = &v;
        }

        if (type != CMPI_null && tmp->state != CMPI_nullValue)
        {

            if (mm_add == TOOL_MM_ADD)
            {

                tmp->value = *value;
            }
            else
            {

                CMPIStatus rc;
                tmp->value = native_clone_CMPIValue ( type, value, &rc );
                // what if clone() fails???
            }
        }
        else
        {
            tmp->state = CMPI_nullValue;
        }

        return 0;
    }
    return( strcmp ( (*prop)->name, name ) == 0 ||
            __addProperty (
                &( (*prop)->next ),
                mm_add,
                name,
                type,
                state,
                value ) );
}