[glib: 3/8] tests: Fix array length calculations in array tests



commit 625055f60e6d59ebad5c3ea8d0a0754d68eb5c1c
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Jul 16 10:16:41 2019 +0100

    tests: Fix array length calculations in array tests
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/tests/array-test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c
index 6405d8003..e27670b0b 100644
--- a/glib/tests/array-test.c
+++ b/glib/tests/array-test.c
@@ -508,8 +508,9 @@ array_copy (gconstpointer test_data)
   /* Check internal parameters ('clear' flag) */
   if (config->clear_)
     {
-      g_array_set_size (array_copy, array_copy->len + 5);
-      for (i = array_copy->len; i < array_copy->len + 5; i++)
+      guint old_length = array_copy->len;
+      g_array_set_size (array_copy, old_length + 5);
+      for (i = old_length; i < old_length + 5; i++)
         g_assert_cmpint (g_array_index (array_copy, gint, i), ==, 0);
     }
 


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