aboutsummaryrefslogtreecommitdiffstats
path: root/epan/export_object.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-01-02 16:24:41 -0500
committerMichael Mann <mmann78@netscape.net>2017-01-02 23:16:34 +0000
commitab075d356342b1f652ec56cf178104e16f68f4dd (patch)
tree50e6a5b7e65c2868cac0b42c6fac7f8f08e19250 /epan/export_object.c
parentc950ebdd0fe3938c4e8087ef1bce6d365d9de1f6 (diff)
Use g_slist_find_custom instead of g_slist_nth when just looking for item in list.
Change-Id: Ida3c5d5826f0ca01a25052a67f1460ff4686008f Reviewed-on: https://code.wireshark.org/review/19513 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/export_object.c')
-rw-r--r--epan/export_object.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/epan/export_object.c b/epan/export_object.c
index 5c7d38fb6e..495609b6b1 100644
--- a/epan/export_object.c
+++ b/epan/export_object.c
@@ -86,19 +86,24 @@ export_object_gui_reset_cb get_eo_reset_func(register_eo_t* eo)
return eo->reset_cb;
}
+static gint
+find_matching_eo(gconstpointer arg1, gconstpointer arg2)
+{
+ register_eo_t *eo = (register_eo_t*)arg1;
+ const gchar *name = (const gchar *)arg2;
+
+ return strcmp(proto_get_protocol_filter_name(eo->proto_id), name);
+}
+
register_eo_t* get_eo_by_name(const char* name)
{
- guint i, size = g_slist_length(registered_eo_tables);
- register_eo_t* eo;
- GSList *slist;
+ GSList *found_eo;
- for (i = 0; i < size; i++) {
- slist = g_slist_nth(registered_eo_tables, i);
- eo = (register_eo_t*)slist->data;
+ found_eo = g_slist_find_custom(registered_eo_tables,
+ (gpointer)name, find_matching_eo);
- if (strcmp(name, proto_get_protocol_filter_name(eo->proto_id)) == 0)
- return eo;
- }
+ if (found_eo)
+ return (register_eo_t*)found_eo->data;
return NULL;
}