mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm-config: Re-link config trees to reflect file order of keys/sections.
This commit is contained in:
parent
687029cbbd
commit
956c192841
@ -154,6 +154,24 @@ struct dm_config_tree *dm_config_insert_cascaded_tree(struct dm_config_tree *fir
|
|||||||
return first_cft;
|
return first_cft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct dm_config_node *_config_reverse(struct dm_config_node *head)
|
||||||
|
{
|
||||||
|
if (!head)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
struct dm_config_node *left = head, *middle = NULL, *right = NULL;
|
||||||
|
|
||||||
|
do {
|
||||||
|
right = middle;
|
||||||
|
middle = left;
|
||||||
|
left = left->sib;
|
||||||
|
middle->sib = right;
|
||||||
|
middle->child = _config_reverse(middle->child);
|
||||||
|
} while (left);
|
||||||
|
|
||||||
|
return middle;
|
||||||
|
};
|
||||||
|
|
||||||
int dm_config_parse(struct dm_config_tree *cft, const char *start, const char *end)
|
int dm_config_parse(struct dm_config_tree *cft, const char *start, const char *end)
|
||||||
{
|
{
|
||||||
/* TODO? if (start == end) return 1; */
|
/* TODO? if (start == end) return 1; */
|
||||||
@ -172,6 +190,8 @@ int dm_config_parse(struct dm_config_tree *cft, const char *start, const char *e
|
|||||||
if (!(cft->root = _file(p)))
|
if (!(cft->root = _file(p)))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
|
cft->root = _config_reverse(cft->root);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user