gallium/auxiliary: make util_dynarray_trim do nothing if size == capacity
authorLuca Barbieri <luca@luca-barbieri.com>
Tue, 13 Apr 2010 06:24:48 +0000 (08:24 +0200)
committerLuca Barbieri <luca@luca-barbieri.com>
Tue, 13 Apr 2010 06:26:00 +0000 (08:26 +0200)
src/gallium/auxiliary/util/u_dynarray.h

index d16d8bf4f3cc8b2258ad106de8770a9bed665715..5597581ef3e0ef76dced515c0dcd1adba4e0eceb 100644 (file)
@@ -87,7 +87,9 @@ util_dynarray_grow(struct util_dynarray *buf, int diff)
 static INLINE void
 util_dynarray_trim(struct util_dynarray *buf)
 {
-   if(buf->size) {
+   if(buf->size != buf->capacity)
+   {}
+   else if(buf->size) {
       buf->data = REALLOC(buf->data, buf->capacity, buf->size);
       buf->capacity = buf->size;
    } else {