projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
31c98ea
)
gallium: added mem_dup()
author
Brian
<brian.paul@tungstengraphics.com>
Wed, 6 Feb 2008 16:28:20 +0000
(09:28 -0700)
committer
Brian
<brian.paul@tungstengraphics.com>
Wed, 6 Feb 2008 16:35:39 +0000
(09:35 -0700)
src/mesa/pipe/p_util.h
patch
|
blob
|
history
diff --git
a/src/mesa/pipe/p_util.h
b/src/mesa/pipe/p_util.h
index 4780ed7818446372fcfa8e930cd8b801198eaeae..991ac447bacd9a8b49c6be8d4c714fdc175ce04b 100644
(file)
--- 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) )