summaryrefslogtreecommitdiffstats
path: root/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
blob: b182240240b37d85d9f3e53adfb9c8586ad42e74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
tree123: avoid compiler unitialized variable error

The compiler does not realize that we must go through the while()
loop at least once, so we replace it with a for() loop.

Upstream-Status: Submitted [email discussion with upstream]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Joe Slater <joe.slater@windriver.com>

Index: git/tree234.c
===================================================================
--- git.orig/tree234.c
+++ git/tree234.c
@@ -335,7 +335,7 @@ static void *add234_internal(tree234 *t,
     }
 
     n = t->root;
-    while (n) {
+    do {
 	LOG(("  node %p: %p/%d \"%s\" %p/%d \"%s\" %p/%d \"%s\" %p/%d\n",
 	     n,
 	     n->kids[0], n->counts[0], n->elems[0],
@@ -388,7 +388,7 @@ static void *add234_internal(tree234 *t,
 	if (!n->kids[ki])
 	    break;
 	n = n->kids[ki];
-    }
+    } while (n);
 
     add234_insert(NULL, e, NULL, &t->root, n, ki);