From a32581abeea9264bba014f5e03063ee60f9c4bdb Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 13 Mar 2009 15:43:52 +0000 Subject: [PATCH] v4l2src: Prepend to lists and reverse them at the end. Gratuitous micro-optimisation - prepend to lists and reverse them, rather than appending to them each time. --- sys/v4l2/v4l2_calls.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index b1875a8..8f1a6c6 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -181,8 +181,9 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) } v4l2object->channels = - g_list_append (v4l2object->channels, (gpointer) channel); + g_list_prepend (v4l2object->channels, (gpointer) channel); } + v4l2object->channels = g_list_reverse (v4l2object->channels); GST_DEBUG_OBJECT (e, " norms"); /* norms... */ @@ -221,8 +222,9 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) standard.frameperiod.denominator, standard.frameperiod.numerator); v4l2norm->index = standard.id; - v4l2object->norms = g_list_append (v4l2object->norms, (gpointer) norm); + v4l2object->norms = g_list_prepend (v4l2object->norms, (gpointer) norm); } + v4l2object->norms = g_list_reverse (v4l2object->norms); GST_DEBUG_OBJECT (e, " controls+menus"); /* and lastly, controls+menus (if appropriate) */ @@ -364,8 +366,10 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) break; } - v4l2object->colors = g_list_append (v4l2object->colors, (gpointer) channel); + v4l2object->colors = + g_list_prepend (v4l2object->colors, (gpointer) channel); } + v4l2object->colors = g_list_reverse (v4l2object->colors); GST_DEBUG_OBJECT (e, "done"); return TRUE; -- 2.7.4