mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-02 18:56:26 +00:00
cgfsng: append_null_to_list()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
3fd0de4d30
commit
8b8db2f6af
@ -211,18 +211,18 @@ static void *must_alloc(size_t sz)
|
||||
return must_realloc(NULL, sz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a pointer to a null-terminated array of pointers, realloc to
|
||||
* add one entry, and point the new entry to NULL. Do not fail. Return
|
||||
* the index to the second-to-last entry - that is, the one which is
|
||||
* now available for use (keeping the list null-terminated).
|
||||
/* Given a pointer to a null-terminated array of pointers, realloc to add one
|
||||
* entry, and point the new entry to NULL. Do not fail. Return the index to the
|
||||
* second-to-last entry - that is, the one which is now available for use
|
||||
* (keeping the list null-terminated).
|
||||
*/
|
||||
static int append_null_to_list(void ***list)
|
||||
{
|
||||
int newentry = 0;
|
||||
|
||||
if (*list)
|
||||
for (; (*list)[newentry]; newentry++);
|
||||
for (; (*list)[newentry]; newentry++)
|
||||
;
|
||||
|
||||
*list = must_realloc(*list, (newentry + 2) * sizeof(void **));
|
||||
(*list)[newentry + 1] = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user