Commit Graph

5 Commits

Author SHA1 Message Date
Jeremy Lakeman
331e0ae576 Add missing include for bzero 2018-04-03 09:44:28 +09:30
Andrew Bettison
c7a2fb4573 Add nibble-tree iterator
The new struct tree_iterator and associated start/get/next/free
functions replace the recursive walk() function, removing the need for a
callback when iterating over all nodes in the tree, and allowing
iteration to be suspended while other pseudo-threads are run.  This
allows an HTTP REST request to keep a tree_iterator in its state struct
and potentially simplifies other areas of the code.

The iterator free()s any empty internal tree nodes that it encounters,
as did the original tree_walk() function.  To support the existence of
multiple iterators at once, a reference count has been added to the
tree_node struct, to prevent any iterator from free()ing a node while
any other iterators point to it; only the last iterator to pop out of an
empty node will free() it.

The tree_walk() and tree_walk_prefix() functions have been
re-implemented to use an iterator state object internally.  This
resolves an outstanding TODO to perform tree-node freeing during a
prefix walk, and simplifies the code considerably.

Renamed some function parameters and struct members to make the
nibble-tree API a little more self-explanatory.

Added a nibble-tree test to the 'serval-tests' utility.
2018-03-29 15:19:54 +10:30
Jeremy Lakeman
a8c29bbb15 Add MeshMB cli commands to follow and ignore feeds 2017-04-19 14:46:36 +09:30
Andrew Bettison
41b3e304be Updated some copyright messages and COPYRIGHT.txt 2016-10-13 16:23:18 +10:30
Jeremy Lakeman
ecb79d818f Refactor storage of binary values to enable reuse 2016-09-13 15:25:39 +09:30