[glib] GSettings: fix mixed use of a pointer



commit 644dfbd704d103df3a7ac13f31cfb87aa03f377d
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun May 2 14:14:30 2010 -0500

    GSettings: fix mixed use of a pointer
    
      - used in some places as a move-along-as-we-go pointer
      - used in other places as a pointer to the fixed base of an array
    
    Switch all users to the first style to avoid a crasher.

 gio/gsettingsbackend.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/gio/gsettingsbackend.c b/gio/gsettingsbackend.c
index a4e1cbe..b5699b4 100644
--- a/gio/gsettingsbackend.c
+++ b/gio/gsettingsbackend.c
@@ -453,7 +453,6 @@ g_settings_backend_flatten_tree (GTree         *tree,
 {
   FlattenState state = { 0, };
   gsize nnodes;
-  gsize i;
 
   nnodes = g_tree_nnodes (tree);
 
@@ -470,8 +469,8 @@ g_settings_backend_flatten_tree (GTree         *tree,
   g_return_if_fail (*keys + nnodes == state.keys);
 
   *path = state.prefix;
-  for (i = 0; i < nnodes; i++)
-    state.keys[i] += state.prefix_len;
+  while (nnodes--)
+    *--state.keys += state.prefix_len;
 }
 
 /**



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