Skip to contentSkip to conversation

master - [radix-tree] Fix bug in _dump

PATCH Joe Thornber 1 participant 1 message Sep 20, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0ac7913c6a43c5bcfbba735652041a0eae4180c6
Commit:        0ac7913c6a43c5bcfbba735652041a0eae4180c6
Parent:        abe2210c261223212435fbfd505842583ee1145a
Author:        Joe Thornber <[email protected]>
AuthorDate:    Thu Sep 20 14:18:57 2018 +0100
Committer:     Joe Thornber <[email protected]>
CommitterDate: Thu Sep 20 14:18:57 2018 +0100

[radix-tree] Fix bug in _dump

Values in an n48 were not being printed in the correct order.

---
 base/data-struct/radix-tree-adaptive.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
base/data-struct/radix-tree-adaptive.c +4 -3
index 233bebd..a657b2b 100644
@@ -1260,9 +1260,10 @@ static void _dump(FILE *out, struct value v, unsigned indent)
 				fprintf(out, "%x ", i);
 		fprintf(out, ">\n");
 
-		for (i = 0; i < 256; i++)
-			if (n48->keys[i] < 48)
-				_dump(out, n48->values[i], indent + 1);
+		for (i = 0; i < n48->nr_entries; i++) {
+			assert(n48->values[i].type != UNSET);
+			_dump(out, n48->values[i], indent + 1);
+		}
 		break;
 
 	case NODE256: