예제 #1
0
void
cf_attributeDeinit (
    cf_attribute attribute)
{
    assert(attribute != NULL);

    switch (attribute->value.kind) {
    case V_BOOLEAN:
    case V_OCTET:
    case V_SHORT:
    case V_LONG:
    case V_LONGLONG:
    case V_USHORT:
    case V_ULONG:
    case V_ULONGLONG:
    case V_FLOAT:
    case V_DOUBLE:
    case V_CHAR:
    break;
    case V_STRING:
        os_free(attribute->value.is.String);
    break;
    case V_WCHAR:
    case V_WSTRING:
    case V_FIXED:
    case V_OBJECT:
    case V_UNDEFINED:
    case V_COUNT:
    default:
        assert(0); /* catch undefined attribute */
    break;
    }

    cf_nodeDeinit(cf_node(attribute));
}
예제 #2
0
void
cf_elementDeinit (
    cf_element element)
{
    assert(element != NULL);
    
    if (element->attributes != NULL) {
        cf_nodeListClear(element->attributes);
        cf_nodeListFree(element->attributes);
        element->attributes = NULL;
    }
    if (element->children != NULL) {
        cf_nodeListClear(element->children);
        cf_nodeListFree(element->children);
        element->children = NULL;
    }

    cf_nodeDeinit(cf_node(element));
}
예제 #3
0
void
cf_dataDeinit (
    cf_data data)
{
    assert(data != NULL);

    switch (data->value.kind) {
    case V_BOOLEAN:
    case V_OCTET:
    case V_SHORT:
    case V_LONG:
    case V_LONGLONG:
    case V_USHORT:
    case V_ULONG:
    case V_ULONGLONG:
    case V_FLOAT:
    case V_DOUBLE:
    case V_CHAR:
      /* nothing to free */;
    break;
    case V_STRING:
        os_free(data->value.is.String);
    break;
    case V_WCHAR:
    case V_WSTRING:
    case V_FIXED:
    case V_OBJECT:
    case V_UNDEFINED:
    case V_COUNT:
    default:
        assert(0); /* catch undefined behaviour */
    break;
    }
    data->value.kind = V_UNDEFINED;

    cf_nodeDeinit(cf_node(data));
}