Fix options: missed setting "pointer" options

personal/stbuehler/wip
Stefan Bühler 13 years ago
parent f14103bc2c
commit 2e4aba7e39
  1. 1
      include/lighttpd/actions.h
  2. 10
      src/main/actions.c
  3. 29
      src/main/plugin.c

@ -87,6 +87,7 @@ LI_API void li_action_release(liServer *srv, liAction *a);
LI_API void li_action_acquire(liAction *a);
/* create new action */
LI_API liAction *li_action_new_setting(liOptionSet setting);
LI_API liAction *li_action_new_settingptr(liOptionPtrSet setting);
LI_API liAction *li_action_new_function(liActionFuncCB func, liActionCleanupCB fcleanup, liActionFreeCB ffree, gpointer param);
LI_API liAction *li_action_new_list();
LI_API liAction *li_action_new_condition(liCondition *cond, liAction *target, liAction *target_else);

@ -64,6 +64,16 @@ liAction *li_action_new_setting(liOptionSet setting) {
return a;
}
liAction *li_action_new_settingptr(liOptionPtrSet setting) {
liAction *a = g_slice_new(liAction);
a->refcount = 1;
a->type = ACTION_TSETTINGPTR;
a->data.settingptr = setting;
return a;
}
liAction *li_action_new_function(liActionFuncCB func, liActionCleanupCB fcleanup, liActionFreeCB ffree, gpointer param) {
liAction *a;

@ -5,7 +5,7 @@ static gboolean plugin_load_default_option(liServer *srv, liServerOption *sopt);
static gboolean plugin_load_default_optionptr(liServer *srv, liServerOptionPtr *sopt);
static void li_plugin_free_default_options(liServer *srv, liPlugin *p);
liOptionPtrValue li_option_ptr_zero = { 0 };
liOptionPtrValue li_option_ptr_zero = { 0, { 0 } , 0 };
static liPlugin* plugin_new(const gchar *name) {
liPlugin *p = g_slice_new0(liPlugin);
@ -379,20 +379,29 @@ void li_release_optionptr(liServer *srv, liOptionPtrValue *value) {
}
liAction* li_option_action(liServer *srv, const gchar *name, liValue *val) {
liOptionSet setting;
liServerOption *sopt;
liServerOptionPtr *soptptr;
if (NULL != (sopt = find_option(srv, name))) {
liOptionSet setting;
if (!li_parse_option(srv, sopt, name, val, &setting)) {
return NULL;
}
return li_action_new_setting(setting);
} else if (NULL != (soptptr = find_optionptr(srv, name))) {
liOptionPtrSet setting;
sopt = find_option(srv, name);
if (!sopt) {
if (!li_parse_optionptr(srv, soptptr, name, val, &setting)) {
return NULL;
}
return li_action_new_settingptr(setting);
} else {
ERROR(srv, "Unknown option '%s'", name);
return FALSE;
}
if (!li_parse_option(srv, sopt, name, val, &setting)) {
return NULL;
}
return li_action_new_setting(setting);
}
liAction* li_create_action(liServer *srv, const gchar *name, liValue *val) {

Loading…
Cancel
Save