diff options
author | Jakub Zawadzki <darkjames@darkjames.pl> | 2014-06-18 16:48:52 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-06-19 22:16:43 +0000 |
commit | a45ce57a1a64adfe48e7c133ecd1ee50182fc9b6 (patch) | |
tree | 3b60fb074d1b627ef1a851fed2d299af7b014171 | |
parent | 8b127685519195d1e57c2859ab86190ee412844c (diff) |
Optimize dissect_sip_route_header()
Don't manually fetch each character to find ',' use tvb_find_guint8()
Change-Id: I29711421469e868a86bf2edd7adf8dcc85ed26eb
Reviewed-on: https://code.wireshark.org/review/2446
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-sip.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index 3edc513881..0797f5cc7e 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -1985,7 +1985,6 @@ dissect_sip_sec_mechanism(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, g static void dissect_sip_route_header(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, hf_sip_uri_t *sip_route_uri_p, gint start_offset, gint line_end_offset) { gint current_offset; - guchar c; uri_offset_info uri_offsets; current_offset = start_offset; @@ -1998,9 +1997,9 @@ static void dissect_sip_route_header(tvbuff_t *tvb, proto_tree *tree, packet_inf } while (current_offset < line_end_offset) { - c = tvb_get_guint8(tvb, current_offset); + current_offset = tvb_find_guint8(tvb, current_offset, (line_end_offset - 1) - current_offset, ','); - if (c == ',') { + if (current_offset != -1) { /* found any ',' ? */ sip_uri_offset_init(&uri_offsets); current_offset = dissect_sip_name_addr_or_addr_spec(tvb, pinfo, start_offset, current_offset, &uri_offsets); if(current_offset == -1) @@ -2010,7 +2009,9 @@ static void dissect_sip_route_header(tvbuff_t *tvb, proto_tree *tree, packet_inf current_offset++; start_offset = current_offset + 1; - } else if (current_offset == line_end_offset - 1) { + } else { + /* current_offset = (line_end_offset - 1); */ + sip_uri_offset_init(&uri_offsets); current_offset = dissect_sip_name_addr_or_addr_spec(tvb, pinfo, start_offset, line_end_offset, &uri_offsets); if(current_offset == -1) |