summaryrefslogtreecommitdiff
path: root/src/mesa/main/imports.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-05-24 03:15:46 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-05-24 03:15:46 +0000
commit1798d9a8a4a779746f5e665357b6bc10a2894d0b (patch)
tree6ba280914b0e6f7ced0641cd221d07596e4b9860 /src/mesa/main/imports.c
parent0c1cbd5805e27914eba7278c51bdd7b3c42b4c52 (diff)
added _mesa_align_realloc()
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r--src/mesa/main/imports.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 5a986f2395..b506f856a6 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -201,6 +201,25 @@ _mesa_align_free(void *ptr)
#endif
}
+/**
+ * Reallocate memory, with alignment.
+ */
+void *
+_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
+ unsigned long alignment)
+{
+ const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
+ void *newBuf = _mesa_align_malloc(newSize, alignment);
+ if (newBuf && oldBuffer && copySize > 0) {
+ _mesa_memcpy(newBuf, oldBuffer, copySize);
+ }
+ if (oldBuffer)
+ _mesa_align_free(oldBuffer);
+ return newBuf;
+}
+
+
+
/** Reallocate memory */
void *
_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)