From c8af89cf722830ec16d594afd99d717aed71d44c Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 6 Feb 2008 09:28:20 -0700 Subject: gallium: added mem_dup() --- src/mesa/pipe/p_util.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/mesa/pipe/p_util.h') 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) ) -- cgit v1.2.3