Code

store: Fixed JSON serialization when skipping hosts due to filters.
authorSebastian Harl <sh@tokkee.org>
Tue, 29 Jul 2014 20:49:44 +0000 (22:49 +0200)
committerSebastian Harl <sh@tokkee.org>
Tue, 29 Jul 2014 20:49:44 +0000 (22:49 +0200)
commit873812bad1b030d79da6402ed6d26d008179592d
tree013e7612c934f4efd5f06c7a1863a75c8d8f1f15
parentab0cdca7fb4f505307f5f0fc4cdcb3ef804e32d8
store: Fixed JSON serialization when skipping hosts due to filters.

Previously, it might have happened that a comma was appended to a list of
hosts even though all subsequent hosts were filtered out. This created invalid
JSON. Now, don't let sdb_store_host_tojson ignore hosts entirely. Instead,
always let it serialize the host passed to the function and only pass on the
filter to child objects. The caller is now responsible for calling the filter
and, at the same time, the caller is able to correctly handle skipped hosts.

Fixed the unit-test which should have caught this.
src/core/store.c
src/include/core/store.h
t/unit/core/store_test.c