From 6c3eebad5c52fde2c198232066b270a5f3996910 Mon Sep 17 00:00:00 2001 From: Raghavendra Date: Tue, 23 Oct 2012 13:15:15 +0530 Subject: libglusterfs/mem-pool: implement gf_memdup Change-Id: I1d7a1e7418f424fe08c041d562098b947c01580f BUG: 808400 Signed-off-by: Raghavendra Reviewed-on: http://review.gluster.org/4124 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/mem-pool.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libglusterfs/src/mem-pool.h') diff --git a/libglusterfs/src/mem-pool.h b/libglusterfs/src/mem-pool.h index 63264c75495..939b4f2a71b 100644 --- a/libglusterfs/src/mem-pool.h +++ b/libglusterfs/src/mem-pool.h @@ -147,6 +147,21 @@ char * gf_strdup (const char *src) return dup_str; } +static inline void * +gf_memdup (const void *src, void *dst, size_t size) +{ + void *dup_mem = NULL; + + dup_mem = GF_CALLOC(1, size, gf_common_mt_strdup); + if (!dup_mem) + goto out; + + memcpy (dup_mem, src, size); + +out: + return dup_mem; +} + struct mem_pool { struct list_head list; int hot_count; -- cgit