diff options
author | Evan Huus <eapache@gmail.com> | 2013-06-09 13:49:16 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-06-09 13:49:16 +0000 |
commit | 226b39f1d72715c1160cfdce3c515b7442c67e80 (patch) | |
tree | d776ac2c66476d2e4a70853df98f47da2a0a29b0 /epan/wmem/wmem_core.c | |
parent | edd3dfd6f88859c187cc93fc8b3654de30a9522f (diff) | |
download | wireshark-226b39f1d72715c1160cfdce3c515b7442c67e80.tar.gz |
Add memdup function to wmem.
svn path=/trunk/; revision=49857
Diffstat (limited to 'epan/wmem/wmem_core.c')
-rw-r--r-- | epan/wmem/wmem_core.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/epan/wmem/wmem_core.c b/epan/wmem/wmem_core.c index 7ffe0fedad..0d0c91fdf2 100644 --- a/epan/wmem/wmem_core.c +++ b/epan/wmem/wmem_core.c @@ -99,6 +99,17 @@ wmem_realloc(wmem_allocator_t *allocator, void *ptr, const size_t size) return allocator->realloc(allocator->private_data, ptr, size); } +void * +wmem_memdup(wmem_allocator_t *allocator, const void *source, const size_t size) +{ + void *dest; + + dest = wmem_alloc(allocator, size); + memcpy(dest, source, size); + + return dest; +} + static void wmem_free_all_real(wmem_allocator_t *allocator, gboolean final) { |