2
0
Fork 0

redo action_new_setting

personal/stbuehler/wip
Stefan Bühler 2008-07-19 12:23:32 +02:00
parent 49dfcddc2a
commit 8c8b77bac2
3 changed files with 15 additions and 32 deletions

View File

@ -13,6 +13,21 @@ struct action_stack_element {
action *action_new_setting(server *srv, GString *name, option *value) {
option_set setting;
if (!parse_option(server *srv, name->str, value, &setting)) {
return NULL;
}
action *a = g_slice_new(action);
a->refcount = 1;
a->type = ACTION_TSETTING;
a->setting = setting;
return a;
}
void action_release(action *a) {
assert(a->refcount > 0);
if (!(--a->refcount)) {
@ -150,19 +165,3 @@ action_result action_execute(server *srv, connection *con) {
}
return ACTION_GO_ON;
}
action *action_new_setting(server *srv, GString *name, option *value) {
gsize ndx;
if (!option_get_index(srv, name, &ndx))
ERROR("unknown setting: \"%s\"", name->str);
action *a = g_slice_new(action);
a->refcount = 1;
a->type = ACTION_TSETTING;
return a;
}

View File

@ -120,17 +120,3 @@ gpointer option_extract_value(option *opt) {
g_slice_free(option, opt);
return val;
}
gboolean option_get_index(server *srv, GString *name, gsize *ndx)
{
gpointer ptr;
ptr = g_hash_table_lookup(srv->options, (gconstpointer) name);
if (ptr == NULL)
return FALSE;
*ndx = 0;
return TRUE;
}

View File

@ -53,6 +53,4 @@ LI_API void option_list_free(GArray *optlist);
/* Extract value from option, destroy option */
LI_API gpointer option_extract_value(option *opt);
gboolean option_get_index(server *srv, GString *name, gsize *ndx);
#endif