~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GNUstep compatibility: spell null selectors "NULL", not "nil".
[sgt/puzzles]
/
tree234.c
diff --git
a/tree234.c
b/tree234.c
index
9699120
..
4b3151e
100644
(file)
--- a/
tree234.c
+++ b/
tree234.c
@@
-1160,7
+1160,7
@@
tree234 *join234r(tree234 *t1, tree234 *t2) {
* in t.
*/
static node234 *split234_internal(tree234 *t, int index) {
* in t.
*/
static node234 *split234_internal(tree234 *t, int index) {
- node234 *halves[2], *n, *sib, *sub;
+ node234 *halves[2]
= { NULL, NULL }
, *n, *sib, *sub;
node234 *lparent, *rparent;
int ki, pki, i, half, lcount, rcount;
node234 *lparent, *rparent;
int ki, pki, i, half, lcount, rcount;
@@
-1182,6
+1182,7
@@
static node234 *split234_internal(tree234 *t, int index) {
/*
* Search down the tree to find the split point.
*/
/*
* Search down the tree to find the split point.
*/
+ halves[0] = halves[1] = NULL;
lparent = rparent = NULL;
pki = -1;
while (n) {
lparent = rparent = NULL;
pki = -1;
while (n) {
@@
-1273,6
+1274,8
@@
static node234 *split234_internal(tree234 *t, int index) {
*/
LOG((" fell off bottom, lroot is %p, rroot is %p\n",
halves[0], halves[1]));
*/
LOG((" fell off bottom, lroot is %p, rroot is %p\n",
halves[0], halves[1]));
+ assert(halves[0] != NULL);
+ assert(halves[1] != NULL);
lparent->counts[pki] = rparent->counts[0] = 0;
lparent->kids[pki] = rparent->kids[0] = NULL;
lparent->counts[pki] = rparent->counts[0] = 0;
lparent->kids[pki] = rparent->kids[0] = NULL;
@@
-1475,6
+1478,7
@@
tree234 *copytree234(tree234 *t, copyfn234 copyfn, void *copyfnstate) {
* if not.)
*/
* if not.)
*/
+#include <string.h>
#include <stdarg.h>
#define srealloc realloc
#include <stdarg.h>
#define srealloc realloc