summaryrefslogtreecommitdiff
path: root/src
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
parent0c1cbd5805e27914eba7278c51bdd7b3c42b4c52 (diff)
added _mesa_align_realloc()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/imports.c19
-rw-r--r--src/mesa/main/imports.h4
2 files changed, 23 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)
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 2827264a3a..6eeb4841ba 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -625,6 +625,10 @@ extern void
_mesa_align_free( void *ptr );
extern void *
+_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
+ unsigned long alignment);
+
+extern void *
_mesa_exec_malloc( GLuint size );
extern void