diff --git a/device_mapper/libdm-config.c b/device_mapper/libdm-config.c index ec7ebca85..38f67f835 100644 --- a/device_mapper/libdm-config.c +++ b/device_mapper/libdm-config.c @@ -175,19 +175,18 @@ static int _do_dm_config_parse(struct dm_config_tree *cft, const char *start, co { /* TODO? if (start == end) return 1; */ - struct parser *p; - if (!(p = dm_pool_zalloc(cft->mem, sizeof(*p)))) - return_0; + struct parser p = { + .mem = cft->mem, + .tb = start, + .te = start, + .fb = start, + .fe = end, + .line = 1, + .no_dup_node_check = no_dup_node_check + }; - p->mem = cft->mem; - p->fb = start; - p->fe = end; - p->tb = p->te = p->fb; - p->line = 1; - p->no_dup_node_check = no_dup_node_check; - - _get_token(p, TOK_SECTION_E); - if (!(cft->root = _file(p))) + _get_token(&p, TOK_SECTION_E); + if (!(cft->root = _file(&p))) return_0; cft->root = _config_reverse(cft->root); diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c index 6383d9004..6a1e19acd 100644 --- a/libdm/libdm-config.c +++ b/libdm/libdm-config.c @@ -175,19 +175,18 @@ static int _do_dm_config_parse(struct dm_config_tree *cft, const char *start, co { /* TODO? if (start == end) return 1; */ - struct parser *p; - if (!(p = dm_pool_zalloc(cft->mem, sizeof(*p)))) - return_0; + struct parser p = { + .mem = cft->mem, + .tb = start, + .te = start, + .fb = start, + .fe = end, + .line = 1, + .no_dup_node_check = no_dup_node_check + }; - p->mem = cft->mem; - p->fb = start; - p->fe = end; - p->tb = p->te = p->fb; - p->line = 1; - p->no_dup_node_check = no_dup_node_check; - - _get_token(p, TOK_SECTION_E); - if (!(cft->root = _file(p))) + _get_token(&p, TOK_SECTION_E); + if (!(cft->root = _file(&p))) return_0; cft->root = _config_reverse(cft->root);