diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-02-06 09:28:20 -0700 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2008-02-15 13:50:32 +1100 |
commit | 67155e8edff96f0a6e85580b0753041e67d3f99d (patch) | |
tree | 1a95dc67cb3c57ed5a5f1af9c1531baeb595a7df /src | |
parent | 64ca0678eeeb39831fcfb309ac48561b1981d360 (diff) |
gallium: added mem_dup()
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/pipe/p_util.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h index 4780ed7818..991ac447ba 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) ) |