Exemple #1
0
void li_value_clear(liValue *val) {
    if (NULL == val) return;

    switch (val->type) {
    case LI_VALUE_NONE:
    case LI_VALUE_BOOLEAN:
    case LI_VALUE_NUMBER:
        /* Nothing to free */
        break;
    case LI_VALUE_STRING:
        g_string_free(val->data.string, TRUE);
        break;
    case LI_VALUE_LIST:
        li_value_list_free(val->data.list);
        break;
    case LI_VALUE_HASH:
        g_hash_table_destroy(val->data.hash);
        break;
    case LI_VALUE_ACTION:
        li_action_release(val->data.val_action.srv, val->data.val_action.action);
        break;
    case LI_VALUE_CONDITION:
        li_condition_release(val->data.val_cond.srv, val->data.val_cond.cond);
        break;
    }
    _li_value_clear(val);
}
Exemple #2
0
void li_common_value_clear_(liValue *val) {
	if (NULL == val) return;

	switch (val->type) {
	case LI_VALUE_NONE:
	case LI_VALUE_BOOLEAN:
	case LI_VALUE_NUMBER:
		/* Nothing to free */
		break;
	case LI_VALUE_STRING:
		g_string_free(val->data.string, TRUE);
		break;
	case LI_VALUE_LIST:
		li_value_list_free(val->data.list);
		break;
	}
	_li_value_clear(val);
}
Exemple #3
0
void li_release_optionptr(liServer *srv, liOptionPtrValue *value) {
	liServerOptionPtr *sopt;
	LI_FORCE_ASSERT(NULL != srv);

	if (NULL == value) return;

	LI_FORCE_ASSERT(g_atomic_int_get(&value->refcount) > 0);
	if (!g_atomic_int_dec_and_test(&value->refcount)) return;

	sopt = value->sopt;
	value->sopt = NULL;
	if (!sopt->free_option) {
		switch (sopt->type) {
		case LI_VALUE_NONE:
		case LI_VALUE_BOOLEAN:
		case LI_VALUE_NUMBER:
			/* Nothing to free */
			break;
		case LI_VALUE_STRING:
			if (value->data.string)
				g_string_free(value->data.string, TRUE);
			break;
		case LI_VALUE_LIST:
			if (value->data.list)
				li_value_list_free(value->data.list);
			break;
		case LI_VALUE_ACTION:
			if (value->data.action)
				li_action_release(srv, value->data.action);
			break;
		case LI_VALUE_CONDITION:
			if (value->data.cond)
				li_condition_release(srv, value->data.cond);
			break;
		}
	} else {
		sopt->free_option(srv, sopt->p, sopt->module_index, value->data.ptr);
	}
	g_slice_free(liOptionPtrValue, value);
}