1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: drop allocation

Use structure allocated on local stack.
This commit is contained in:
Zdenek Kabelac 2024-05-17 16:50:49 +02:00
parent fdfe80f024
commit 93115ef91d
2 changed files with 22 additions and 24 deletions

View File

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

View File

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