aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndersBroman <anders.broman@ericsson.com>2017-12-04 13:20:19 +0100
committerAnders Broman <a.broman58@gmail.com>2017-12-04 13:23:10 +0000
commitb3f0004af7e203df2d5d887a72fe7af7b9c217e2 (patch)
treec3ddc616560a0948592e1995409298d0c5a4a063
parent48841d0b5b10382ac7064c0704c5e346100fb08f (diff)
Use g_list_prepend() it's faster.
Change-Id: I950901c56df230826a6011a6dcf34195b11fa61a Reviewed-on: https://code.wireshark.org/review/24702 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--ui/capture.c4
-rw-r--r--ui/capture_ui_utils.c5
-rw-r--r--ui/filter_files.c2
3 files changed, 7 insertions, 4 deletions
diff --git a/ui/capture.c b/ui/capture.c
index 1e1c837..68e667d 100644
--- a/ui/capture.c
+++ b/ui/capture.c
@@ -86,7 +86,7 @@ capture_callback_add(capture_callback_t func, gpointer user_data)
cb->cb_fct = func;
cb->user_data = user_data;
- capture_callbacks = g_list_append(capture_callbacks, cb);
+ capture_callbacks = g_list_prepend(capture_callbacks, cb);
}
void
@@ -664,7 +664,7 @@ capture_stat_start(capture_options *capture_opts)
sc_item = (if_stat_cache_item_t *)g_malloc0(sizeof(if_stat_cache_item_t));
g_assert(device->if_info.name);
sc_item->name = g_strdup(device->if_info.name);
- sc->cache_list = g_list_append(sc->cache_list, sc_item);
+ sc->cache_list = g_list_prepend(sc->cache_list, sc_item);
}
}
} else {
diff --git a/ui/capture_ui_utils.c b/ui/capture_ui_utils.c
index 7813647..84b1f77 100644
--- a/ui/capture_ui_utils.c
+++ b/ui/capture_ui_utils.c
@@ -360,9 +360,12 @@ build_capture_combo_list(GList *if_list, gboolean do_hide)
if_string = g_strdup(if_info->name);
}
}
- combo_list = g_list_append(combo_list, if_string);
+ combo_list = g_list_prepend(combo_list, if_string);
}
}/*for*/
+ if(combo_list){
+ combo_list = g_list_reverse(combo_list);
+ }
}
return combo_list;
}
diff --git a/ui/filter_files.c b/ui/filter_files.c
index 96c32a4..54b7bf2 100644
--- a/ui/filter_files.c
+++ b/ui/filter_files.c
@@ -86,7 +86,7 @@ add_filter_entry(GList *fl, const char *filt_name, const char *filt_expr)
filt = (filter_def *) g_malloc(sizeof(filter_def));
filt->name = g_strdup(filt_name);
filt->strval = g_strdup(filt_expr);
- return g_list_append(fl, filt);
+ return g_list_prepend(fl, filt);
}
static void