aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/README.dissector12
-rw-r--r--doc/README.tapping2
-rw-r--r--docbook/wsdg_src/WSDG_chapter_dissection.asciidoc2
-rw-r--r--epan/ftypes/ftype-integer.c6
-rw-r--r--epan/guid-utils.c8
-rw-r--r--epan/proto.c7
-rw-r--r--epan/proto.h2
7 files changed, 19 insertions, 20 deletions
diff --git a/doc/README.dissector b/doc/README.dissector
index 3bbb342798..7a3f9ffab3 100644
--- a/doc/README.dissector
+++ b/doc/README.dissector
@@ -312,16 +312,16 @@ information).
Byte Array Accessors:
-gchar *tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len);
+gchar *tvb_bytes_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint len);
Formats a bunch of data from a tvbuff as bytes, returning a pointer
to the string with the data formatted as two hex digits for each byte.
-The string pointed to is stored in an "ep_alloc'd" buffer which will be freed
-before the next frame is dissected. The formatted string will contain the hex digits
-for at most the first 16 bytes of the data. If len is greater than 16 bytes, a
-trailing "..." will be added to the string.
+The string pointed to is stored in an "wmem_alloc'd" buffer which will be freed
+depending on its scope (typically wmem_packet_scope which is freed after the frame).
+The formatted string will contain the hex digits for at most the first 16 bytes of
+the data. If len is greater than 16 bytes, a trailing "..." will be added to the string.
-gchar *tvb_bytes_to_str_punct(tvbuff_t *tvb, gint offset, gint len, gchar punct);
+gchar *tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint len, gchar punct);
This function is similar to tvb_bytes_to_str(...) except that 'punct' is inserted
between the hex representation of each byte.
diff --git a/doc/README.tapping b/doc/README.tapping
index bc460a400c..75b99ac69c 100644
--- a/doc/README.tapping
+++ b/doc/README.tapping
@@ -197,7 +197,7 @@ tap_queue_packet() is using its own instance of private struct variable
so they don't overwrite each other.
See packet-ip.c which has a simple solution to the problem. It creates
-a unique instance of the IP header using ep_alloc().
+a unique instance of the IP header using wmem_alloc().
Previous versions used a static struct of 4 instances of the IP header
struct and cycled through them each time the dissector was called. (4
was just a number taken out of the blue but it should be enough for most
diff --git a/docbook/wsdg_src/WSDG_chapter_dissection.asciidoc b/docbook/wsdg_src/WSDG_chapter_dissection.asciidoc
index cc17d9cdd2..30d239294f 100644
--- a/docbook/wsdg_src/WSDG_chapter_dissection.asciidoc
+++ b/docbook/wsdg_src/WSDG_chapter_dissection.asciidoc
@@ -1017,7 +1017,7 @@ of the dissector.
void dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
...
- fooinfo = ep_alloc(sizeof(struct FooTap));
+ fooinfo = wmem_alloc(wmem_packet_scope(), sizeof(struct FooTap));
fooinfo->packet_type = tvb_get_guint8(tvb, 0);
fooinfo->priority = tvb_get_ntohs(tvb, 8);
...
diff --git a/epan/ftypes/ftype-integer.c b/epan/ftypes/ftype-integer.c
index 2368b526b5..0aaf0aba6d 100644
--- a/epan/ftypes/ftype-integer.c
+++ b/epan/ftypes/ftype-integer.c
@@ -636,10 +636,10 @@ eui64_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_, int field_display _U_)
static void
eui64_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf)
{
- guint8 *p_eui64 = (guint8 *)ep_alloc(8);
+ guint8 *p_eui64 = (guint8 *)ep_alloc(8);
- /* Copy and convert the address to network byte order. */
- *(guint64 *)(void *)(p_eui64) = pntoh64(&(fv->value.integer64));
+ /* Copy and convert the address to network byte order. */
+ *(guint64 *)(void *)(p_eui64) = pntoh64(&(fv->value.integer64));
g_snprintf(buf, EUI64_STR_LEN, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
p_eui64[0], p_eui64[1], p_eui64[2], p_eui64[3],
diff --git a/epan/guid-utils.c b/epan/guid-utils.c
index 490ebd1a08..66020afd4d 100644
--- a/epan/guid-utils.c
+++ b/epan/guid-utils.c
@@ -51,8 +51,8 @@ ResolveWin32UUID(e_guid_t if_id, char *uuid_name, int uuid_name_max_len)
DWORD uuid_max_size = MAX_PATH;
TCHAR *reg_uuid_str;
- reg_uuid_name=ep_alloc(MAX_PATH*sizeof(TCHAR));
- reg_uuid_str=ep_alloc(MAX_PATH*sizeof(TCHAR));
+ reg_uuid_name=wmem_alloc(wmem_packet_scope(), MAX_PATH*sizeof(TCHAR));
+ reg_uuid_str=wmem_alloc(wmem_packet_scope(), MAX_PATH*sizeof(TCHAR));
if(uuid_name_max_len < 2){
return 0;
@@ -159,7 +159,7 @@ guids_get_guid_name(const e_guid_t *guid)
#ifdef _WIN32
/* try to resolve the mapping from the Windows registry */
/* XXX - prefill the resolving database with all the Windows registry entries once at init only (instead of searching each time)? */
- uuid_name=ep_alloc(128);
+ uuid_name=wmem_alloc(wmem_packet_scope(), 128);
if(ResolveWin32UUID(*guid, uuid_name, 128)) {
return uuid_name;
}
@@ -191,7 +191,7 @@ guids_resolve_guid_to_str(const e_guid_t *guid)
return name;
}
- return ep_strdup_printf("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ return wmem_strdup_printf(wmem_packet_scope(), "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
guid->data1, guid->data2, guid->data3,
guid->data4[0], guid->data4[1],
guid->data4[2], guid->data4[3],
diff --git a/epan/proto.c b/epan/proto.c
index bec4dd4fd5..53c421270b 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -908,7 +908,7 @@ ptvcursor_new_subtree_levels(ptvcursor_t *ptvc)
DISSECTOR_ASSERT(ptvc->pushed_tree_max <= SUBTREE_MAX_LEVELS-SUBTREE_ONCE_ALLOCATION_NUMBER);
ptvc->pushed_tree_max += SUBTREE_ONCE_ALLOCATION_NUMBER;
- pushed_tree = (subtree_lvl *)ep_alloc(sizeof(subtree_lvl) * ptvc->pushed_tree_max);
+ pushed_tree = (subtree_lvl *)wmem_alloc(wmem_packet_scope(), sizeof(subtree_lvl) * ptvc->pushed_tree_max);
DISSECTOR_ASSERT(pushed_tree != NULL);
if (ptvc->pushed_tree)
memcpy(pushed_tree, ptvc->pushed_tree, ptvc->pushed_tree_max - SUBTREE_ONCE_ALLOCATION_NUMBER);
@@ -931,7 +931,7 @@ ptvcursor_new(proto_tree *tree, tvbuff_t *tvb, gint offset)
{
ptvcursor_t *ptvc;
- ptvc = (ptvcursor_t *)ep_alloc(sizeof(ptvcursor_t));
+ ptvc = (ptvcursor_t *)wmem_alloc(wmem_packet_scope(), sizeof(ptvcursor_t));
ptvc->tree = tree;
ptvc->tvb = tvb;
ptvc->offset = offset;
@@ -8027,7 +8027,7 @@ proto_tree_add_split_bits_item_ret_val(proto_tree *tree, const int hfindex, tvbu
guint mask_greatest_bit_offset;
guint octet_length;
guint8 i;
- char *bf_str;
+ char bf_str[256];
char lbl_str[ITEM_LABEL_LENGTH];
guint64 value;
guint64 composite_bitmask;
@@ -8109,7 +8109,6 @@ proto_tree_add_split_bits_item_ret_val(proto_tree *tree, const int hfindex, tvbu
TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hf_field);
/* initialise the format string */
- bf_str = (char *)ep_alloc(256);
bf_str[0] = '\0';
octet_offset = bit_offset >> 3;
diff --git a/epan/proto.h b/epan/proto.h
index 9ddb552292..5a5b1aed2b 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -103,7 +103,7 @@ typedef struct _protocol protocol_t;
* the Info column and the protocol tree.
*
* If that string is dynamically allocated, it should be allocated with
- * ep_alloc(); using ep_strdup_printf() would work.
+ * wmem_alloc() with wmem_packet_scope(); using wmem_strdup_printf() would work.
*
* If the WIRESHARK_ABORT_ON_DISSECTOR_BUG environment variable is set,
* it will call abort(), instead, to make it easier to get a stack trace.