summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRaghavendra <raghavendra@gluster.com>2012-10-23 13:15:15 +0530
committerVijay Bellur <vbellur@redhat.com>2012-11-27 22:44:19 -0800
commit6c3eebad5c52fde2c198232066b270a5f3996910 (patch)
tree8670464847fe560992fcd6b647aeec3f2eb5b3ac /libglusterfs
parentda0972232e97e761a839d9db9bbe7a04c6ff13e9 (diff)
libglusterfs/mem-pool: implement gf_memdup
Change-Id: I1d7a1e7418f424fe08c041d562098b947c01580f BUG: 808400 Signed-off-by: Raghavendra <raghavendra@gluster.com> Reviewed-on: http://review.gluster.org/4124 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/mem-pool.h15
1 files changed, 15 insertions, 0 deletions
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;