summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/uci/uci_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/plugins/uci/uci_parser.c')
-rw-r--r--src/libcharon/plugins/uci/uci_parser.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/libcharon/plugins/uci/uci_parser.c b/src/libcharon/plugins/uci/uci_parser.c
index 2429e9e44..e847dd393 100644
--- a/src/libcharon/plugins/uci/uci_parser.c
+++ b/src/libcharon/plugins/uci/uci_parser.c
@@ -58,11 +58,10 @@ typedef struct {
} section_enumerator_t;
METHOD(enumerator_t, section_enumerator_enumerate, bool,
- section_enumerator_t *this, ...)
+ section_enumerator_t *this, va_list args)
{
struct uci_element *element;
char **value;
- va_list args;
int i;
if (&this->current->list == this->list)
@@ -70,8 +69,6 @@ METHOD(enumerator_t, section_enumerator_enumerate, bool,
return FALSE;
}
- va_start(args, this);
-
value = va_arg(args, char**);
if (value)
{
@@ -96,7 +93,6 @@ METHOD(enumerator_t, section_enumerator_enumerate, bool,
*value = uci_to_option(element)->value;
}
}
- va_end(args);
this->current = list_to_element(this->current->list.next);
return TRUE;
@@ -124,7 +120,13 @@ METHOD(uci_parser_t, create_section_enumerator, enumerator_t*,
i++;
}
va_end(args);
- e = malloc(sizeof(section_enumerator_t) + sizeof(char*) * i);
+ INIT_EXTRA(e, sizeof(char*) * i,
+ .public = {
+ .enumerate = enumerator_enumerate_default,
+ .venumerate = _section_enumerator_enumerate,
+ .destroy = _section_enumerator_destroy,
+ },
+ );
i = 0;
va_start(args, this);
do
@@ -134,9 +136,6 @@ METHOD(uci_parser_t, create_section_enumerator, enumerator_t*,
while (e->keywords[i++]);
va_end(args);
- e->public.enumerate = (void*)_section_enumerator_enumerate;
- e->public.destroy = _section_enumerator_destroy;
-
/* load uci context */
e->ctx = uci_alloc_context();
if (uci_load(e->ctx, this->package, &e->package) != UCI_OK)