diff options
author | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-08-13 19:42:46 +0000 |
---|---|---|
committer | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-08-13 19:42:46 +0000 |
commit | 80a6d3fbcf1d8ee469fbdb6c2d6423f942cbe712 (patch) | |
tree | 41a0430751c01d746062340b6b29c96147592b9f /gtk/rtp_analysis.c | |
parent | 97fda7386c87b840410a1804feee134ab0572276 (diff) |
Introduce epan_dissect_init()/epan_dissect_cleanup(). These are used to initialise/cleanup stack allocated 'edt' structures. This should speed up dissection since we avoid some malloc traffic.
svn path=/trunk/; revision=29404
Diffstat (limited to 'gtk/rtp_analysis.c')
-rw-r--r-- | gtk/rtp_analysis.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c index 0813a0cc46..7279109ec9 100644 --- a/gtk/rtp_analysis.c +++ b/gtk/rtp_analysis.c @@ -3670,7 +3670,7 @@ static void rtp_analysis_cb(GtkWidget *w _U_, gpointer data _U_) gchar filter_text[256]; dfilter_t *sfcode; capture_file *cf; - epan_dissect_t *edt; + epan_dissect_t edt; gint err; gchar *err_info; gboolean frame_matched; @@ -3701,41 +3701,41 @@ static void rtp_analysis_cb(GtkWidget *w _U_, gpointer data _U_) cf_read_error_message(err, err_info), cf->filename); return; } - edt = epan_dissect_new(TRUE, FALSE); - epan_dissect_prime_dfilter(edt, sfcode); - epan_dissect_run(edt, &cf->pseudo_header, cf->pd, fdata, NULL); - frame_matched = dfilter_apply_edt(sfcode, edt); + epan_dissect_init(&edt, TRUE, FALSE); + epan_dissect_prime_dfilter(&edt, sfcode); + epan_dissect_run(&edt, &cf->pseudo_header, cf->pd, fdata, NULL); + frame_matched = dfilter_apply_edt(sfcode, &edt); /* if it is not an rtp frame, show the rtpstream dialog */ - frame_matched = dfilter_apply_edt(sfcode, edt); + frame_matched = dfilter_apply_edt(sfcode, &edt); if (frame_matched != 1) { - epan_dissect_free(edt); + epan_dissect_cleanup(&edt); simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "You didn't choose a RTP packet!"); return; } /* ok, it is a RTP frame, so let's get the ip and port values */ - COPY_ADDRESS(&(ip_src_fwd), &(edt->pi.src)) - COPY_ADDRESS(&(ip_dst_fwd), &(edt->pi.dst)) - port_src_fwd = edt->pi.srcport; - port_dst_fwd = edt->pi.destport; + COPY_ADDRESS(&(ip_src_fwd), &(edt.pi.src)) + COPY_ADDRESS(&(ip_dst_fwd), &(edt.pi.dst)) + port_src_fwd = edt.pi.srcport; + port_dst_fwd = edt.pi.destport; /* assume the inverse ip/port combination for the reverse direction */ - COPY_ADDRESS(&(ip_src_rev), &(edt->pi.dst)) - COPY_ADDRESS(&(ip_dst_rev), &(edt->pi.src)) - port_src_rev = edt->pi.destport; - port_dst_rev = edt->pi.srcport; + COPY_ADDRESS(&(ip_src_rev), &(edt.pi.dst)) + COPY_ADDRESS(&(ip_dst_rev), &(edt.pi.src)) + port_src_rev = edt.pi.destport; + port_dst_rev = edt.pi.srcport; /* check if it is RTP Version 2 */ - if (!get_int_value_from_proto_tree(edt->tree, "rtp", "rtp.version", &version_fwd) || version_fwd != 2) { + if (!get_int_value_from_proto_tree(edt.tree, "rtp", "rtp.version", &version_fwd) || version_fwd != 2) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "RTP Version != 2 isn't supported!"); return; } /* now we need the SSRC value of the current frame */ - if (!get_int_value_from_proto_tree(edt->tree, "rtp", "rtp.ssrc", &ssrc_fwd)) { + if (!get_int_value_from_proto_tree(edt.tree, "rtp", "rtp.ssrc", &ssrc_fwd)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "SSRC value couldn't be found!"); return; |