diff options
author | Bill Meier <wmeier@newsguy.com> | 2013-10-29 14:09:20 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2013-10-29 14:09:20 +0000 |
commit | 0ad98563a24b8685545825aac889ef43bfc58809 (patch) | |
tree | d44e5d34582bc2a05ba6be6bd8d818e9a813147f /plugins | |
parent | 86c145ecb33495023a7966030faab5a69a3067eb (diff) |
From didier gautheron: remove redundant or use faster col_xxx functions
- when the text parameter is constant col_add_str() and col_set_str() are equivalent but col_set_str() is faster.
- same for replace col_append_fstr and col_append_str
- remove col_clear() when it's redundant:
+ before a col_set/col_add if the dissector can't throw an exception.
- replace col_append() after a col_clear() with faster col_add... or col_set
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9344
svn path=/trunk/; revision=52948
Diffstat (limited to 'plugins')
29 files changed, 10 insertions, 37 deletions
diff --git a/plugins/docsis/packet-bintrngreq.c b/plugins/docsis/packet-bintrngreq.c index 5b2256a85b..710efc7c5e 100644 --- a/plugins/docsis/packet-bintrngreq.c +++ b/plugins/docsis/packet-bintrngreq.c @@ -50,7 +50,6 @@ dissect_bintrngreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) md_ds_sg_id = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Bonded Ranging Request: MD-DS-SG-ID = %u (0x%X)", md_ds_sg_id, md_ds_sg_id ); diff --git a/plugins/docsis/packet-cmctrlreq.c b/plugins/docsis/packet-cmctrlreq.c index dcadf54560..86555220f2 100644 --- a/plugins/docsis/packet-cmctrlreq.c +++ b/plugins/docsis/packet-cmctrlreq.c @@ -46,7 +46,6 @@ dissect_cmctrlreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "CM Control Request: Transaction-Id = %u", transid); diff --git a/plugins/docsis/packet-cmctrlrsp.c b/plugins/docsis/packet-cmctrlrsp.c index c0195bfce1..60ec51ee87 100644 --- a/plugins/docsis/packet-cmctrlrsp.c +++ b/plugins/docsis/packet-cmctrlrsp.c @@ -54,7 +54,6 @@ dissect_cmctrlrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "CM Control Response: Transaction-Id = %u", transid); diff --git a/plugins/docsis/packet-cmstatus.c b/plugins/docsis/packet-cmstatus.c index 2e2b100246..7681879c15 100644 --- a/plugins/docsis/packet-cmstatus.c +++ b/plugins/docsis/packet-cmstatus.c @@ -144,7 +144,6 @@ dissect_cmstatus (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); event_type = tvb_get_guint8 (tvb, 2); len = tvb_reported_length_remaining (tvb, 3); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "CM-STATUS Report: Transaction ID = %u", transid); if (tree) diff --git a/plugins/docsis/packet-dbcack.c b/plugins/docsis/packet-dbcack.c index e2b43788e2..a7fc8f2337 100644 --- a/plugins/docsis/packet-dbcack.c +++ b/plugins/docsis/packet-dbcack.c @@ -46,7 +46,6 @@ dissect_dbcack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Dynamic Bonding Change Acknowledge: Tran-Id = %u", transid); diff --git a/plugins/docsis/packet-dbcreq.c b/plugins/docsis/packet-dbcreq.c index 3b073854b9..89b65836cc 100644 --- a/plugins/docsis/packet-dbcreq.c +++ b/plugins/docsis/packet-dbcreq.c @@ -48,7 +48,6 @@ dissect_dbcreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Dynamic Bonding Change Request: Tran-Id = %u", transid); diff --git a/plugins/docsis/packet-dbcrsp.c b/plugins/docsis/packet-dbcrsp.c index 34d0a18402..f40c2dac54 100644 --- a/plugins/docsis/packet-dbcrsp.c +++ b/plugins/docsis/packet-dbcrsp.c @@ -51,7 +51,6 @@ dissect_dbcrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); confcode = tvb_get_guint8 (tvb, 2); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Dynamic Bonding Change Response: Tran-Id = %u (%s)", transid, val_to_str (confcode, docsis_conf_code, "%d")); diff --git a/plugins/docsis/packet-docsis.c b/plugins/docsis/packet-docsis.c index d6e709a893..2c1dfd3a39 100644 --- a/plugins/docsis/packet-docsis.c +++ b/plugins/docsis/packet-docsis.c @@ -403,7 +403,6 @@ dissect_docsis (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) /* Make entries in Protocol column and Info column on summary display */ col_set_str (pinfo->cinfo, COL_PROTOCOL, "DOCSIS"); - col_clear (pinfo->cinfo, COL_INFO); switch (fctype) { case FCTYPE_PACKET: diff --git a/plugins/docsis/packet-dpvreq.c b/plugins/docsis/packet-dpvreq.c index d3a9035b50..cadb81563b 100644 --- a/plugins/docsis/packet-dpvreq.c +++ b/plugins/docsis/packet-dpvreq.c @@ -54,7 +54,6 @@ dissect_dpvreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); dschan = tvb_get_guint8 (tvb, 2); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "DOCSIS Path Verify Request: Transaction-Id = %u DS-Ch %d", transid, dschan); diff --git a/plugins/docsis/packet-dpvrsp.c b/plugins/docsis/packet-dpvrsp.c index c8bf0d2a5e..d2af746a9f 100644 --- a/plugins/docsis/packet-dpvrsp.c +++ b/plugins/docsis/packet-dpvrsp.c @@ -54,7 +54,6 @@ dissect_dpvrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); dschan = tvb_get_guint8 (tvb, 2); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "DOCSIS Path Verify Response: Transaction-Id = %u DS-Ch %d", transid, dschan); diff --git a/plugins/docsis/packet-dsareq.c b/plugins/docsis/packet-dsareq.c index 1e3b9be75e..f4333f85dd 100644 --- a/plugins/docsis/packet-dsareq.c +++ b/plugins/docsis/packet-dsareq.c @@ -48,7 +48,6 @@ dissect_dsareq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Dynamic Service Addition Request Tran-id = %u", transid); diff --git a/plugins/docsis/packet-dscreq.c b/plugins/docsis/packet-dscreq.c index ac7aac268c..fefa3ea9a4 100644 --- a/plugins/docsis/packet-dscreq.c +++ b/plugins/docsis/packet-dscreq.c @@ -49,7 +49,6 @@ dissect_dscreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Dynamic Service Change Request Tran-id = %u", transid); diff --git a/plugins/docsis/packet-dsdreq.c b/plugins/docsis/packet-dsdreq.c index 40c0be2765..6769323d32 100644 --- a/plugins/docsis/packet-dsdreq.c +++ b/plugins/docsis/packet-dsdreq.c @@ -51,7 +51,6 @@ dissect_dsdreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) transid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Dynamic Service Delete Request Tran-id = %u", transid); if (tree) diff --git a/plugins/docsis/packet-intrngreq.c b/plugins/docsis/packet-intrngreq.c index 2c7f1f204e..3dbbb555f0 100644 --- a/plugins/docsis/packet-intrngreq.c +++ b/plugins/docsis/packet-intrngreq.c @@ -48,7 +48,6 @@ dissect_intrngreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) sid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Ranging Request: SID = %u",sid); if (tree) diff --git a/plugins/docsis/packet-map.c b/plugins/docsis/packet-map.c index b4f275a2a7..1c67a7c455 100644 --- a/plugins/docsis/packet-map.c +++ b/plugins/docsis/packet-map.c @@ -84,7 +84,6 @@ dissect_map (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) upchid = tvb_get_guint8 (tvb, 0); ucd_count = tvb_get_guint8 (tvb, 1); - col_clear (pinfo->cinfo, COL_INFO); if (upchid > 0) col_add_fstr (pinfo->cinfo, COL_INFO, "Map Message: Channel ID = %u (U%u), UCD Count = %u, # IE's = %u", diff --git a/plugins/docsis/packet-regreq.c b/plugins/docsis/packet-regreq.c index dd26d5c7ff..a9a27b1810 100644 --- a/plugins/docsis/packet-regreq.c +++ b/plugins/docsis/packet-regreq.c @@ -49,7 +49,6 @@ dissect_regreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) sid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Registration Request SID = %u", sid); diff --git a/plugins/docsis/packet-rngreq.c b/plugins/docsis/packet-rngreq.c index 5deba47e12..b5c451c73e 100644 --- a/plugins/docsis/packet-rngreq.c +++ b/plugins/docsis/packet-rngreq.c @@ -48,7 +48,6 @@ dissect_rngreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) sid = tvb_get_ntohs (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); if (sid > 0) col_add_fstr (pinfo->cinfo, COL_INFO, "Ranging Request: SID = %u", sid); diff --git a/plugins/docsis/packet-rngrsp.c b/plugins/docsis/packet-rngrsp.c index 6a2cf0543e..c641941c87 100644 --- a/plugins/docsis/packet-rngrsp.c +++ b/plugins/docsis/packet-rngrsp.c @@ -74,7 +74,6 @@ dissect_rngrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) sid = tvb_get_ntohs (tvb, 0); upchid = tvb_get_guint8 (tvb, 2); - col_clear (pinfo->cinfo, COL_INFO); if (upchid > 0) col_add_fstr (pinfo->cinfo, COL_INFO, "Ranging Response: SID = %u, Upstream Channel = %u (U%u)", diff --git a/plugins/docsis/packet-type29ucd.c b/plugins/docsis/packet-type29ucd.c index 40d415123d..2689805605 100644 --- a/plugins/docsis/packet-type29ucd.c +++ b/plugins/docsis/packet-type29ucd.c @@ -204,7 +204,6 @@ dissect_type29ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) upchid = tvb_get_guint8 (tvb, 0); /* if the upstream Channel ID is 0 then this is for Telephony Return) */ - col_clear (pinfo->cinfo, COL_INFO); if (upchid > 0) col_add_fstr (pinfo->cinfo, COL_INFO, "type29ucd Message: Channel ID = %u (U%u)", upchid, diff --git a/plugins/docsis/packet-uccreq.c b/plugins/docsis/packet-uccreq.c index 817bc54c7b..ff8aff00d0 100644 --- a/plugins/docsis/packet-uccreq.c +++ b/plugins/docsis/packet-uccreq.c @@ -48,7 +48,6 @@ dissect_uccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) chid = tvb_get_guint8 (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Upstream Channel Change request Channel ID = %u (U%u)", chid, (chid > 0 ? chid - 1 : chid)); diff --git a/plugins/docsis/packet-uccrsp.c b/plugins/docsis/packet-uccrsp.c index ac33e40402..2dbd88770f 100644 --- a/plugins/docsis/packet-uccrsp.c +++ b/plugins/docsis/packet-uccrsp.c @@ -46,7 +46,6 @@ dissect_uccrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) chid = tvb_get_guint8 (tvb, 0); - col_clear (pinfo->cinfo, COL_INFO); col_add_fstr (pinfo->cinfo, COL_INFO, "Upstream Channel Change response Channel ID = %u (U%u)", chid, (chid > 0 ? chid - 1 : chid)); diff --git a/plugins/docsis/packet-ucd.c b/plugins/docsis/packet-ucd.c index 7d83f4a408..df0cf1a170 100644 --- a/plugins/docsis/packet-ucd.c +++ b/plugins/docsis/packet-ucd.c @@ -169,7 +169,6 @@ static void upchid = tvb_get_guint8 (tvb, 0); /* if the upstream Channel ID is 0 then this is for Telephony Return) */ - col_clear (pinfo->cinfo, COL_INFO); if (upchid > 0) col_add_fstr (pinfo->cinfo, COL_INFO, "UCD Message: Channel ID = %u (U%u)", upchid, diff --git a/plugins/ethercat/packet-ioraw.c b/plugins/ethercat/packet-ioraw.c index 2b93188082..94f8bcb378 100644 --- a/plugins/ethercat/packet-ioraw.c +++ b/plugins/ethercat/packet-ioraw.c @@ -61,11 +61,8 @@ static void dissect_ioraw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "IO-RAW"); - col_clear(pinfo->cinfo, COL_INFO); - - IoRawSummaryFormater(szText, nMax); - col_append_str(pinfo->cinfo, COL_INFO, szText); + col_add_str(pinfo->cinfo, COL_INFO, szText); if (tree) { diff --git a/plugins/irda/packet-irda.c b/plugins/irda/packet-irda.c index 2e4c8548a3..4e245239b5 100644 --- a/plugins/irda/packet-irda.c +++ b/plugins/irda/packet-irda.c @@ -595,7 +595,7 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r } } - col_add_str(pinfo->cinfo, COL_INFO, "GetValueByClass: \""); + col_set_str(pinfo->cinfo, COL_INFO, "GetValueByClass: \""); tvb_memcpy(tvb, buf, offset + 1 + 1, clen); memcpy(&buf[clen], "\" \"", 3); diff --git a/plugins/profinet/packet-dcerpc-pn-io.c b/plugins/profinet/packet-dcerpc-pn-io.c index 4ac139503c..477156631a 100644 --- a/plugins/profinet/packet-dcerpc-pn-io.c +++ b/plugins/profinet/packet-dcerpc-pn-io.c @@ -8588,8 +8588,7 @@ dissect_ProfiDriveParameterRequest(tvbuff_t *tvb, int offset, request_reference, val_to_str(request_id, pn_io_profidrive_request_id_vals, "Unknown"), do_id, no_of_parameters); - col_clear(pinfo->cinfo, COL_INFO); - col_append_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Write Request, ReqRef:0x%02x, %s DO:%u", + col_add_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Write Request, ReqRef:0x%02x, %s DO:%u", request_reference, request_id==0x01 ? "Read" : request_id==0x02 ? "Change" : @@ -8692,8 +8691,7 @@ dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, request_reference, val_to_str(response_id, pn_io_profidrive_response_id_vals, "Unknown"), do_id, no_of_parameters); - col_clear(pinfo->cinfo, COL_INFO); - col_append_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Read Response, ReqRef:0x%02x, RspId:%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Read Response, ReqRef:0x%02x, RspId:%s", request_reference, val_to_str(response_id, pn_io_profidrive_response_id_vals, "Unknown response")); diff --git a/plugins/profinet/packet-dcom-cba-acco.c b/plugins/profinet/packet-dcom-cba-acco.c index 02231e4ef2..5d3bb936af 100644 --- a/plugins/profinet/packet-dcom-cba-acco.c +++ b/plugins/profinet/packet-dcom-cba-acco.c @@ -2759,7 +2759,7 @@ dissect_Server_GetProvIDs_resp(tvbuff_t *tvb, int offset, } else if (u32Idx < 10) { col_append_fstr(pinfo->cinfo, COL_INFO, ",0x%x", u32ProvID); } else if (u32Idx == 10) { - col_append_fstr(pinfo->cinfo, COL_INFO, ",..."); + col_append_str(pinfo->cinfo, COL_INFO, ",..."); } u32Idx++; @@ -3709,7 +3709,7 @@ dissect_ICBAAccoMgt_GetIDs_resp(tvbuff_t *tvb, int offset, } else if (u32Idx < 10) { col_append_fstr(pinfo->cinfo, COL_INFO, ",0x%x", u32ConsID); } else if (u32Idx == 10) { - col_append_fstr(pinfo->cinfo, COL_INFO, ",..."); + col_append_str(pinfo->cinfo, COL_INFO, ",..."); } u32Idx++; @@ -3766,7 +3766,7 @@ dissect_ICBAAccoMgt2_GetConsIDs_resp(tvbuff_t *tvb, int offset, } else if (u32Idx < 10) { col_append_fstr(pinfo->cinfo, COL_INFO, ",0x%x", u32ConsID); } else if (u32Idx == 10) { - col_append_fstr(pinfo->cinfo, COL_INFO, ",..."); + col_append_str(pinfo->cinfo, COL_INFO, ",..."); } u32Idx++; diff --git a/plugins/profinet/packet-pn-mrp.c b/plugins/profinet/packet-pn-mrp.c index bc94ea0f51..697c2f33fe 100644 --- a/plugins/profinet/packet-pn-mrp.c +++ b/plugins/profinet/packet-pn-mrp.c @@ -384,7 +384,7 @@ dissect_PNMRP_PDU(tvbuff_t *tvb, int offset, } else { proto_item_append_text(item, " "); } - col_append_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(type, pn_mrp_block_type_vals, "Unknown TLVType 0x%x")); + col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(type, pn_mrp_block_type_vals, "Unknown TLVType 0x%x")); proto_item_append_text(item, "%s", val_to_str_const(type, pn_mrp_block_type_vals, "Unknown TLVType 0x%x")); switch(type) { diff --git a/plugins/profinet/packet-pn-ptcp.c b/plugins/profinet/packet-pn-ptcp.c index db048c4491..3fdbf4df76 100644 --- a/plugins/profinet/packet-pn-ptcp.c +++ b/plugins/profinet/packet-pn-ptcp.c @@ -346,7 +346,7 @@ dissect_PNPTCP_Master(tvbuff_t *tvb, int offset, ClockVariance); } else { - col_append_fstr(pinfo->cinfo, COL_INFO, " active"); + col_append_str(pinfo->cinfo, COL_INFO, " active"); proto_item_append_text(item, ": Prio1=\"%s\" is active, Prio2=%s, Clock: Class=\"%s\", Accuracy=%s, Variance=%d", val_to_str(MasterPriority1 & 0x7, pn_ptcp_master_prio1_vals, "(Reserved: 0x%x)"), val_to_str(MasterPriority2, pn_ptcp_master_prio2_vals, "(Reserved: 0x%x)"), diff --git a/plugins/wimaxmacphy/packet-wimaxmacphy.c b/plugins/wimaxmacphy/packet-wimaxmacphy.c index 8385fc195c..29bb0cdb66 100644 --- a/plugins/wimaxmacphy/packet-wimaxmacphy.c +++ b/plugins/wimaxmacphy/packet-wimaxmacphy.c @@ -2425,7 +2425,7 @@ dissect_wimaxmacphy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d #if 0 col_add_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(message_type, &wimaxmacphy_message_type_vals_ext, "Unknown")); #endif - col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(message_type, wimaxmacphy_message_type_vals, "Unknown")); + col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(message_type, wimaxmacphy_message_type_vals, "Unknown")); offset += 1; switch(message_type) |