summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-06 09:28:20 -0700
committerBrian <[email protected]>2008-02-06 09:35:39 -0700
commitc8af89cf722830ec16d594afd99d717aed71d44c (patch)
tree54c67450b92b4882ba2db019ca13418bb7ececa9 /src/mesa
parent31c98eafb043cbc82e5de206ceecc5888174b5e6 (diff)
gallium: added mem_dup()
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/p_util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h
index 4780ed78184..991ac447bac 100644
--- a/src/mesa/pipe/p_util.h
+++ b/src/mesa/pipe/p_util.h
@@ -183,6 +183,20 @@ align_free(void *ptr)
+/**
+ * Duplicate of a block of memory
+ */
+static INLINE void *
+mem_dup(const void *src, uint size)
+{
+ void *dup = malloc(size);
+ if (dup)
+ memcpy(dup, src, size);
+ return dup;
+}
+
+
+
#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )