diff options
author | Evan Huus <eapache@gmail.com> | 2013-01-04 22:11:13 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-01-04 22:11:13 +0000 |
commit | bab105d094c6fd89ee542d36f6777681ae96f68b (patch) | |
tree | 5b073ae11ab8212b03669e475a0f79e4565bde90 | |
parent | c16ab7b57e60c34b6c911565013e5fa103ee2305 (diff) | |
download | wireshark-bab105d094c6fd89ee542d36f6777681ae96f68b.tar.gz wireshark-bab105d094c6fd89ee542d36f6777681ae96f68b.tar.bz2 wireshark-bab105d094c6fd89ee542d36f6777681ae96f68b.zip |
Add convenience macros wmem_new and wmem_new0
svn path=/trunk/; revision=46941
-rw-r--r-- | doc/README.wmem | 2 | ||||
-rw-r--r-- | epan/wmem/wmem_core.h | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/doc/README.wmem b/doc/README.wmem index 23f841f267..945e23b6a5 100644 --- a/doc/README.wmem +++ b/doc/README.wmem @@ -77,6 +77,8 @@ to the lifetime of the pinfo struct. - wmem_alloc - wmem_alloc0 + - wmem_new + - wmem_new0 2.3 String Utilities diff --git a/epan/wmem/wmem_core.h b/epan/wmem/wmem_core.h index ad71591252..b0fdac9873 100644 --- a/epan/wmem/wmem_core.h +++ b/epan/wmem/wmem_core.h @@ -40,13 +40,15 @@ typedef enum _wmem_allocator_type_t { struct _wmem_allocator_t; -typedef struct _wmem_allocator_t wmem_allocator_t; +typedef struct _wmem_allocator_t wmem_allocator_t; void * wmem_alloc(wmem_allocator_t *allocator, const size_t size); +#define wmem_new(allocator, type) ((type*)wmem_alloc((allocator), sizeof(type))) void * wmem_alloc0(wmem_allocator_t *allocator, const size_t size); +#define wmem_new0(allocator, type) ((type*)wmem_alloc0((allocator), sizeof(type))) void wmem_free_all(wmem_allocator_t *allocator); |