redo action_new_setting

personal/stbuehler/wip
Stefan Bühler 15 years ago
parent 49dfcddc2a
commit 8c8b77bac2
  1. 31
      src/actions.c
  2. 14
      src/options.c
  3. 2
      src/options.h

@ -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;
}

@ -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;
}

@ -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

Loading…
Cancel
Save