You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lighttpd2/src/options.c

50 lines
1.0 KiB

15 years ago
#include "base.h"
15 years ago
/* Extract ovalue from ovalue, ovalue set to none */
option_value value_extract(value *val) {
option_value oval = {0};
if (!val) return oval;
switch (val->type) {
case VALUE_NONE:
break;
case VALUE_BOOLEAN:
oval.boolean = val->data.boolean;
break;
case VALUE_NUMBER:
oval.number = val->data.number;
15 years ago
break;
case VALUE_STRING:
oval.string = val->data.string;
15 years ago
break;
case VALUE_LIST:
oval.list = val->data.list;
15 years ago
break;
case VALUE_HASH:
oval.hash = val->data.hash;
15 years ago
break;
case VALUE_ACTION:
oval.ptr = val->data.val_action.action;
break;
case VALUE_CONDITION:
oval.ptr = val->data.val_action.action;
break;
15 years ago
}
val->type = VALUE_NONE;
return oval;
15 years ago
}
gpointer value_extract_ptr(value *val) {
option_value oval = value_extract(val);
return oval.ptr;
}
gint64 value_extract_number(value *val) {
option_value oval = value_extract(val);
return oval.number;
}
gboolean value_extract_bool(value *val) {
option_value oval = value_extract(val);
return oval.boolean;
}