diff options
author | Evan Huus <eapache@gmail.com> | 2014-04-20 17:27:18 -0400 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-04-21 15:37:06 +0000 |
commit | d47ae54806201a868b7e012e52d1bab19b78ae06 (patch) | |
tree | a5f6bd1a761ee2c1545eeae3fa8f0e934315caec /ui/gtk/supported_protos_dlg.c | |
parent | 5983cda769fa6615dda5fc7b8f87819d40f0a8d5 (diff) |
Replace linked list of proto fields with array
This is substantially more memory-efficient, shaving another ~1.5MB off our base
usage. It also lets us remove the annoying extra "last_field" pointer and
simplify proto_register_field_common(). It also accidentally fixed what may
have been a memory leak in proto_unregister_field().
It unfortunately complicates proto_get_next_protocol_field() to require
refetching the protocol each time, but that is itself just an array-lookup under
the covers (and isn't much used), so I don't expect the performance hit to be
noticable.
Change-Id: I8e1006b2326d6563fc3b710b827cc99b54440df1
Reviewed-on: https://code.wireshark.org/review/1225
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'ui/gtk/supported_protos_dlg.c')
-rw-r--r-- | ui/gtk/supported_protos_dlg.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/gtk/supported_protos_dlg.c b/ui/gtk/supported_protos_dlg.c index ffb7c20d68..4609bd1e91 100644 --- a/ui/gtk/supported_protos_dlg.c +++ b/ui/gtk/supported_protos_dlg.c @@ -255,7 +255,7 @@ static void set_supported_text(GtkWidget *w, supported_type_t type) i = proto_get_next_protocol(&cookie)) { for (hfinfo = proto_get_first_protocol_field(i, &cookie2); hfinfo != NULL; - hfinfo = proto_get_next_protocol_field(&cookie2)) { + hfinfo = proto_get_next_protocol_field(i, &cookie2)) { if (hfinfo->same_name_prev_id != -1) /* ignore duplicate names */ continue; @@ -283,7 +283,7 @@ static void set_supported_text(GtkWidget *w, supported_type_t type) count = 0; for (hfinfo = proto_get_first_protocol_field(i, &cookie2); hfinfo != NULL; - hfinfo = proto_get_next_protocol_field(&cookie2)) { + hfinfo = proto_get_next_protocol_field(i, &cookie2)) { if (hfinfo->same_name_prev_id != -1) /* ignore duplicate names */ continue; @@ -296,7 +296,7 @@ static void set_supported_text(GtkWidget *w, supported_type_t type) insert_text(w, buffer, len); for (hfinfo = proto_get_first_protocol_field(i, &cookie2); hfinfo != NULL; - hfinfo = proto_get_next_protocol_field(&cookie2)) { + hfinfo = proto_get_next_protocol_field(i, &cookie2)) { if (hfinfo->same_name_prev_id != -1) /* ignore duplicate names */ continue; |