[vte/vte-0-32] table: Move GValueArray existence check/creation out of loop



commit bfecfad9912fb13201b7d6d3c74331496cd3d523
Author: Christian Persch <chpe gnome org>
Date:   Wed May 23 18:51:16 2012 +0200

    table: Move GValueArray existence check/creation out of loop

 src/table.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/table.c b/src/table.c
index 85cf631..77698b5 100644
--- a/src/table.c
+++ b/src/table.c
@@ -538,6 +538,10 @@ _vte_table_extract_numbers(GValueArray **array,
 	GValue value = {0,};
 	gssize i;
 
+        if (G_UNLIKELY (*array == NULL)) {
+                *array = g_value_array_new(1);
+        }
+
 	g_value_init(&value, G_TYPE_LONG);
 	i = 0;
 	do {
@@ -547,9 +551,6 @@ _vte_table_extract_numbers(GValueArray **array,
 			total *= 10;
 			total += v == -1 ?  0 : v;
 		}
-		if (G_UNLIKELY (*array == NULL)) {
-			*array = g_value_array_new(1);
-		}
 		g_value_set_long(&value, CLAMP (total, 0, G_MAXUSHORT));
 		g_value_array_append(*array, &value);
 	} while (i++ < arginfo->length);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]