summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-02-06 09:28:20 -0700
committerBen Skeggs <skeggsb@gmail.com>2008-02-15 13:50:32 +1100
commit67155e8edff96f0a6e85580b0753041e67d3f99d (patch)
tree1a95dc67cb3c57ed5a5f1af9c1531baeb595a7df
parent64ca0678eeeb39831fcfb309ac48561b1981d360 (diff)
gallium: added mem_dup()
-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) )