Move resetting packet_info structure from dissect_packet() to epan_dissect_init()

It'd be actually good idea to seperate packet_info data (packet.c) from epan_dissect_t (epan.c),
but this rule is already violated.

Strict seperation could allow for example allow multiple dissection on the same epan_dissect_t
(I think it was idea behind it), but it's not working.

svn path=/trunk/; revision=52705
This commit is contained in:
Jakub Zawadzki 2013-10-20 10:11:16 +00:00
parent 336befd903
commit 107e4a6c80
2 changed files with 3 additions and 7 deletions

View File

@ -220,7 +220,6 @@ epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_pr
g_assert(edt);
edt->session = session;
edt->pi.pool = wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE);
if (create_proto_tree) {
edt->tree = proto_tree_create_root(&edt->pi);
@ -230,7 +229,8 @@ epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_pr
edt->tree = NULL;
}
edt->pi.dependent_frames = NULL;
memset(&edt->pi, 0, sizeof(edt->pi));
edt->pi.pool = wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE);
return edt;
}

View File

@ -404,14 +404,10 @@ void
dissect_packet(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
tvbuff_t *tvb, frame_data *fd, column_info *cinfo)
{
/* We have to preserve the pool pointer across the memzeroing */
wmem_allocator_t *tmp = edt->pi.pool;
if (cinfo != NULL)
col_init(cinfo, edt->session);
memset(&edt->pi, 0, sizeof(edt->pi));
edt->pi.epan = edt->session;
edt->pi.pool = tmp;
/* edt->pi.pool created in epan_dissect_init() */
edt->pi.current_proto = "<Missing Protocol Name>";
edt->pi.cinfo = cinfo;
edt->pi.fd = fd;