mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
str_list: also allow memory allocation without memory pool
This commit is contained in:
parent
17196103e0
commit
097d14e64e
@ -20,7 +20,8 @@ struct dm_list *str_list_create(struct dm_pool *mem)
|
|||||||
{
|
{
|
||||||
struct dm_list *sl;
|
struct dm_list *sl;
|
||||||
|
|
||||||
if (!(sl = dm_pool_alloc(mem, sizeof(struct dm_list)))) {
|
if (!(sl = mem ? dm_pool_alloc(mem, sizeof(struct dm_list))
|
||||||
|
: dm_malloc(sizeof(struct dm_list)))) {
|
||||||
log_errno(ENOMEM, "str_list allocation failed");
|
log_errno(ENOMEM, "str_list allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -37,7 +38,8 @@ static int _str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll,
|
|||||||
if (!str)
|
if (!str)
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!(sln = dm_pool_alloc(mem, sizeof(*sln))))
|
if (!(sln = mem ? dm_pool_alloc(mem, sizeof(*sln))
|
||||||
|
: dm_malloc(sizeof(*sln))))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
sln->str = str;
|
sln->str = str;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user