diff options
-rw-r--r-- | libglusterfs/src/mem-pool.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libglusterfs/src/mem-pool.h b/libglusterfs/src/mem-pool.h index 63264c754..939b4f2a7 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; |