small fixes; call_setup() now looks in the right hashtable
parent
c2e6044315
commit
708b5fc223
|
@ -352,8 +352,13 @@
|
|||
|
||||
assert(name->type == OPTION_STRING);
|
||||
|
||||
if (g_str_has_prefix(name->value.opt_string->str, "var.")) {
|
||||
if (ctx->in_setup_block) {
|
||||
}
|
||||
else {
|
||||
if (g_str_has_prefix(name->value.opt_string->str, "var.")) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
al = g_queue_peek_head(ctx->action_list_stack);
|
||||
|
||||
|
@ -393,11 +398,24 @@ UNUSED(a); UNUSED(al);
|
|||
}
|
||||
else {
|
||||
/* TODO */
|
||||
al = g_queue_peek_head(ctx->action_list_stack);
|
||||
UNUSED(a);
|
||||
if (ctx->in_setup_block) {
|
||||
/* we are in the setup { } block, call setups and don't append to action list */
|
||||
if (!call_setup(srv, name->value.opt_string->str, val)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
al = g_queue_peek_head(ctx->action_list_stack);
|
||||
a = create_action(srv, name->value.opt_string->str, val);
|
||||
|
||||
if (a == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
_printf("got function: %s %s; in line %zd\n", name->value.opt_string->str, option_type_string(val->type), ctx->line);
|
||||
|
||||
option_free(name);
|
||||
}
|
||||
|
||||
action condition_start {
|
||||
|
@ -526,7 +544,7 @@ void config_parser_finish(server *srv, GList *ctx_stack) {
|
|||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
_printf("ctx_stack size: %u", g_list_length(ctx_stack));
|
||||
_printf("ctx_stack size: %u\n", g_list_length(ctx_stack));
|
||||
|
||||
/* clear all contexts from the stack */
|
||||
while ((ctx = g_list_nth_data(ctx_stack, 1)) != NULL) {
|
||||
|
|
|
@ -73,9 +73,7 @@ int main(int argc, char *argv[]) {
|
|||
GList *ctx_stack = config_parser_init(srv);
|
||||
config_parser_context_t *ctx = (config_parser_context_t*) ctx_stack->data;
|
||||
if (!config_parser_file(srv, ctx_stack, config_path)) {
|
||||
for (guint i = 0; i < g_queue_get_length(ctx->action_list_stack); i++) { /* TODO */ }
|
||||
for (guint i = 0; i < g_queue_get_length(ctx->option_stack); i++) { option_free(g_queue_peek_nth(ctx->option_stack, i)); }
|
||||
config_parser_context_free(srv, ctx, FALSE);
|
||||
config_parser_finish(srv, ctx_stack);
|
||||
log_thread_start(srv);
|
||||
g_atomic_int_set(&srv->exiting, TRUE);
|
||||
log_thread_wakeup(srv);
|
||||
|
|
|
@ -247,7 +247,7 @@ action* create_action(server *srv, const gchar *name, option *value) {
|
|||
gboolean call_setup(server *srv, const char *name, option *opt) {
|
||||
server_setup *ss;
|
||||
|
||||
if (NULL == (ss = (server_setup*) g_hash_table_lookup(srv->actions, name))) {
|
||||
if (NULL == (ss = (server_setup*) g_hash_table_lookup(srv->setups, name))) {
|
||||
ERROR(srv, "Setup function '%s' doesn't exist", name);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue