gallium/auxiliary: add util_dynarray_resize

This commit is contained in:
Luca Barbieri
2010-04-13 08:23:29 +02:00
parent c572619817
commit 6c31dd1198
+8 -2
View File
@@ -59,10 +59,10 @@ util_dynarray_fini(struct util_dynarray *buf)
}
}
/* use util_dynarray_trim to reduce the allocated storage */
static INLINE void *
util_dynarray_grow(struct util_dynarray *buf, int size)
util_dynarray_resize(struct util_dynarray *buf, unsigned newsize)
{
unsigned newsize = buf->size + size;
char *p;
if(newsize > buf->capacity)
{
@@ -78,6 +78,12 @@ util_dynarray_grow(struct util_dynarray *buf, int size)
return p;
}
static INLINE void *
util_dynarray_grow(struct util_dynarray *buf, int diff)
{
return util_dynarray_resize(buf, buf->size + diff);
}
static INLINE void
util_dynarray_trim(struct util_dynarray *buf)
{