Zdenek Kabelac
8bb5dd5430
base: use calloc
...
Make zalloc a wrapper over calloc
2018-11-29 23:05:43 +01:00
Zdenek Kabelac
9238b972c5
cov: mark warning as expected one
2018-11-03 16:10:32 +01:00
Zdenek Kabelac
c7789daec0
cov: overflow before widen
...
Evaluate as 64bit arithmetic (instead of doing 32bit mults which can
in this case purely teoretically overflow).
2018-11-03 16:10:31 +01:00
Zdenek Kabelac
30b1b57506
cov: add at least ASSERT
...
Seems lot of code here can't handle failing allocation.
Meanwhile before bigger fix put in asserts in place.
2018-10-15 17:49:44 +02:00
Zdenek Kabelac
eed8715e1d
cov: fix missing null allocation check
2018-10-15 17:49:44 +02:00
Joe Thornber
8424655af9
Merge branch '2018-09-13-radix-tree-bug'
2018-09-20 14:43:51 +01:00
Joe Thornber
bda4f3a7ae
[build] switch back to the adaptive radix tree
2018-09-20 14:40:28 +01:00
Joe Thornber
bb17302084
[radix-tree] tidy up _degrade_to_n48
...
Shouldn't be any functional changes.
2018-09-20 14:28:47 +01:00
Joe Thornber
ebd2d7773f
[radix-tree] Fix bug in _degrade_to_n16
...
Values were getting shuffled
2018-09-20 14:20:16 +01:00
Joe Thornber
0ac7913c6a
[radix-tree] Fix bug in _dump
...
Values in an n48 were not being printed in the correct order.
2018-09-20 14:18:57 +01:00
Joe Thornber
abe2210c26
[radix-tree] Add some extra checks to is_well_formed()
2018-09-20 14:18:10 +01:00
David Teigland
41ef146dc3
radix-tree: default to simple version
...
Avoid problems with the advanced version.
2018-09-17 11:19:53 -05:00
Joe Thornber
4d964133e2
[radix-tree] alternative radix-tree implementation.
...
Sacrifices performance for simplicity, meant only for verification of
the real adaptive implementation.
2018-09-11 13:12:07 +01:00
Joe Thornber
8b05f1f230
radix-tree: Fix bug in remove_prefix()
...
Accidental decrement of the nr entries when a n256 didn't have the
entry in the first place.
2018-08-20 15:23:40 +01:00
Joe Thornber
254e5c5d11
radix-tree: squash a pointer arithmetic warning
2018-06-21 17:41:56 +01:00
Joe Thornber
72e2e92f4c
radix-tree: fix bug when erasing elts in remove_prefix
...
_erase_elt() now zeroes the last element of the array (ie. sets to
UNSET). Previously remove() was doing this, but not remove_prefix().
2018-06-21 17:10:05 +01:00
Joe Thornber
40c1f7889f
radix-tree: More debugging of remove
...
There's now a pretty printer called radix_tree_dump()
n4, n16, and n48 weren't UNSETting the last entry after
sliding values down.
2018-06-21 09:49:43 +01:00
Joe Thornber
20b9746c5d
radix-tree: FIx various bugs to do with removal
...
Add radix_tree_is_well_formed() which does some sanity checking
of the tree.
Call the above a lot in the unit tests.
Fix revealed bugs.
2018-06-21 09:49:08 +01:00
Joe Thornber
61e67e51e1
device_mapper: move hash.[hc] to base/data-struct
2018-06-08 13:54:19 +01:00
Joe Thornber
88ae928ca3
base: Move list to base/data-struct
2018-06-08 11:24:18 +01:00
Joe Thornber
2eda683a20
build: base/Makefile
...
.gitignore hid it.
2018-06-04 15:37:35 +01:00
Joe Thornber
06c789eda1
radix-tree: fix some bugs in remove_prefix and iterate
...
These weren't working if the prefix key was part of a prefix_chain.
2018-05-30 14:21:27 +01:00
Joe Thornber
1924426ad1
radix-tree: radix_tree_iterate()
2018-05-29 17:58:58 +01:00
Joe Thornber
c2a8bbed3b
radix-tree: radix_tree_remove_prefix()
2018-05-29 13:25:59 +01:00
Joe Thornber
9b41efae82
radix-tree: call the value dtr when removing an entry.
2018-05-29 11:23:36 +01:00
Joe Thornber
0181c77e3f
Merge branch '2018-05-29-radix-tree-iterate' into 2018-05-23-radix-tree-remove
2018-05-29 11:04:32 +01:00
Joe Thornber
033df741e2
data-struct/radix-tree: pass the value dtr into create.
...
Rather than having to pass it into every method that removes items.
2018-05-29 11:03:10 +01:00
Joe Thornber
b7fd8ac8eb
radix_tree: add remove method
2018-05-23 12:48:06 +01:00
Joe Thornber
30a4c7988e
radix-tree: remove some unneccessary includes
2018-05-11 09:46:34 +01:00
Joe Thornber
576dd1fc41
radix-tree: First drop of radix tree.
...
An implementation of an adaptive radix tree. Has the following nice
properties:
- At least as fast as the hash table
- Uses less memory
- You don't need to give an expected size when you create
- It scales nicely (ie. no large reallocations like the hash table).
- You can iterate the keys in lexicographical order.
Only insert and lookup are implemented so far. Plus there's a lot
more performance to come.
2018-05-11 06:10:01 +01:00