1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2018, Linaro Limited 4 */ 5 #include <malloc.h> 6 #include <stddef.h> 7 #include <util.h> 8 unw_grow(void * p,size_t * cur_size,size_t new_size)9static inline void *unw_grow(void *p, size_t *cur_size, size_t new_size) 10 { 11 size_t rounded_size = 0; 12 void *tmp = NULL; 13 14 if (*cur_size >= new_size) 15 return p; 16 17 rounded_size = ROUNDUP(new_size, 16 * sizeof(vaddr_t)); 18 tmp = realloc(p, rounded_size); 19 20 if (tmp) 21 *cur_size = rounded_size; 22 return tmp; 23 } 24