aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-04-13 08:23:29 +0200
committerLuca Barbieri <[email protected]>2010-04-13 08:25:39 +0200
commit6c31dd119878378540b6bdbb2f47bc5ab6cc516f (patch)
tree29253ad2251dd7c684521c0047dfcd3e56e7af55
parentc57261981702f78f0df1426c405a7e891ef81639 (diff)
gallium/auxiliary: add util_dynarray_resize
-rw-r--r--src/gallium/auxiliary/util/u_dynarray.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_dynarray.h b/src/gallium/auxiliary/util/u_dynarray.h
index 5d124832be3..d16d8bf4f3c 100644
--- a/src/gallium/auxiliary/util/u_dynarray.h
+++ b/src/gallium/auxiliary/util/u_dynarray.h
@@ -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)
{