diff options
Diffstat (limited to 'epan/emem.h')
-rw-r--r-- | epan/emem.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/epan/emem.h b/epan/emem.h index c40efd3100..af10c7e637 100644 --- a/epan/emem.h +++ b/epan/emem.h @@ -45,6 +45,9 @@ void ep_init_chunk(void); /* Allocate memory with a packet lifetime scope */ void *ep_alloc(size_t size); +/* Allocate memory with a packet lifetime scope and fill it with zeros*/ +void* ep_alloc0(size_t size); + /* Duplicate a string with a packet lifetime scope */ gchar* ep_strdup(const gchar* src); @@ -57,6 +60,17 @@ guint8* ep_memdup(const guint8* src, size_t len); /* Create a formated string with a packet lifetime scope */ gchar* ep_strdup_printf(const gchar* fmt, ...); +/* allocates with a packet lifetime scope a array of type made of num elements */ +#define ep_alloc_array(type,num) (type*)ep_alloc(sizeof(type)*(num)) + +/* + * Splits a string into a maximum of max_tokens pieces, using the given + * delimiter. If max_tokens is reached, the remainder of string is appended + * to the last token. + * the vector and all the strings are allocated with packet lifetime scope + */ +gchar** ep_strsplit(const gchar* string, const gchar* delimiter, int max_tokens); + /* release all memory allocated in the previous packet dissector */ void ep_free_all(void); |