src/lib/bPlusTree.c 1.6

1.6 2009/09/24 03:34:20 kent
Fixing problem with bptTraverse on larger data sets. Causes problems in bigWig on scaffolded assemblies.
Index: src/lib/bPlusTree.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/bPlusTree.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -b -B -U 4 -r1.5 -r1.6
--- src/lib/bPlusTree.c	9 Feb 2009 02:51:42 -0000	1.5
+++ src/lib/bPlusTree.c	24 Sep 2009 03:34:20 -0000	1.6
@@ -189,15 +189,18 @@
 	}
     }
 else
     {
-    /* Loop through remainder. */
+    bits64 fileOffsets[childCount];
+    /* Loop through to get file offsets of children. */
     for (i=0; i<childCount; ++i)
 	{
 	udcMustRead(bpt->udc, keyBuf, bpt->keySize);
-	bits64 fileOffset = udcReadBits64(bpt->udc, isSwapped);
-	rTraverse(bpt, fileOffset, context, callback);
+	fileOffsets[i] = udcReadBits64(bpt->udc, isSwapped);
 	}
+    /* Loop through recursing on child offsets. */
+    for (i=0; i<childCount; ++i)
+	rTraverse(bpt, fileOffsets[i], context, callback);
     }
 }
 
 boolean bptFileFind(struct bptFile *bpt, void *key, int keySize, void *val, int valSize)