Wireshark-bugs: [Wireshark-bugs] [Bug 3972] speed up a little proto_custom_set
Date: Tue, 1 Sep 2009 21:45:56 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3972





--- Comment #1 from Kovarththanan Rajaratnam <kovarththanan.rajaratnam@xxxxxxxxx>  2009-09-01 21:45:55 PDT ---
(From update of attachment 3596)
>   for (i = cinfo->col_first[COL_CUSTOM];
>
>        i <= cinfo->col_last[COL_CUSTOM]; i++) {
>
>+    cinfo->col_custom_field_id[i] = -1;
>
>     if (cinfo->fmt_matx[i][COL_CUSTOM] &&
>
>-        cinfo->col_custom_dfilter[i])
>
>+        cinfo->col_custom_dfilter[i]) {
>
>         epan_dissect_prime_dfilter(edt, cinfo->col_custom_dfilter[i]);
>
>+        if (cinfo->col_custom_field) {
>
>+            header_field_info* hfinfo = proto_registrar_get_byname(cinfo->col_custom_field[i]);
>
>+            /* ASSERT if none ? */
>

Yes, please turn this into an assert.

> const gchar *
>
>-proto_custom_set(proto_tree* tree, const gchar *field,
>
>+proto_custom_set(proto_tree* tree, int field_id,
>
>                              gchar *result,
>
>                              gchar *expr, int size )
>
> {
>
>@@ -3182,13 +3182,10 @@
>
> 	field_info	*finfo;
>
> 	header_field_info* hfinfo;
>
> 	
>
>-	if (!field)
>
>+	if (field_id == -1)
>
> 		return "";
>

Do we ever call this function with field_id == -1? If not, please turn this
into an assert.


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.