blob: 2959e0d06f871c7037fb93e35c0fa8188ac5869b [file] [log] [blame]
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* Copyright (c) 2018, Linaro Limited
*/
#include <malloc.h>
#include <stddef.h>
#include <util.h>
static inline void *unw_grow(void *p, size_t *cur_size, size_t new_size)
{
if (*cur_size >= new_size)
return p;
size_t rounded_size = ROUNDUP(new_size, 16 * sizeof(vaddr_t));
void *tmp = realloc(p, rounded_size);
if (tmp)
*cur_size = rounded_size;
return tmp;
}