[vte/vte-next] table: Move GValueArray existence check/creation out of loop (cherry picked from commit bfecfad9912f



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

    table: Move GValueArray existence check/creation out of loop
    (cherry picked from commit bfecfad9912fb13201b7d6d3c74331496cd3d523)

 src/table.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/table.c b/src/table.c
index 8f1cbdf..8ec5d0a 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]