summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/imports.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-04-08 02:22:41 +0000
committerBrian Paul <[email protected]>2003-04-08 02:22:41 +0000
commit0cebd5822a39ad3b3d7621f8e59efab329bfb5b9 (patch)
treef7220e7219a9e0e8e903df3e3b416bb7cc98071f /src/mesa/main/imports.c
parentb8ca0172e7562f2ed92ef99903980aae2e806a94 (diff)
added _mesa_realloc()
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r--src/mesa/main/imports.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 8474ed4abcf..a1c974ca755 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -1,5 +1,3 @@
-/* $Id: imports.c,v 1.33 2003/03/04 16:33:53 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -181,6 +179,19 @@ _mesa_align_free(void *ptr)
void *
+_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
+{
+ const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
+ void *newBuffer = _mesa_malloc(newSize);
+ if (newBuffer && copySize > 0)
+ _mesa_memcpy(newBuffer, oldBuffer, copySize);
+ if (oldBuffer)
+ _mesa_free(oldBuffer);
+ return newBuffer;
+}
+
+
+void *
_mesa_memcpy(void *dest, const void *src, size_t n)
{
#if defined(XFree86LOADER) && defined(IN_MODULE)