summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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