aboutsummaryrefslogtreecommitdiffstats
path: root/epan/emem.h
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2005-07-26 18:32:12 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2005-07-26 18:32:12 +0000
commitc5688891a15aad52c20feed8cf401e0e51f5cbf7 (patch)
tree340a32503d93c49eb5e3db35d7a7caa9f99afa07 /epan/emem.h
parentda94bcb0e7d0fcd2dca65cfc39ccf685f0cf01cd (diff)
new functions:
ep_tvb_memdup() ep_alloc0() ep_strsplit() add all of the ep_ allocators to libethereal.def svn path=/trunk/; revision=15100
Diffstat (limited to 'epan/emem.h')
-rw-r--r--epan/emem.h14
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);