Refactor object destruction somewhat

This just paves the way for easily bailing out of functions that
create objects on the fly, but as a nice sideeffect it also makes
it easier to find the functions we need to change when modifying
how we allocate objects. The fact that we get rid of a lot of
duplicated code is another neat bonus.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Refactor object post-processing

By putting host post-processing in its own function, we can more
easily add objects during runtime, provided we add a special event
for it that tells our modules to pause while we modify the in-core
structures.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Link rather than copy parent hostnames

Previously we used to copy the parent names since we could never
be sure we had the parent host already parsed and input into the
hashlist.

Since we want to eventually add support for adding hosts during
runtime, we can save ourselves a bit of trouble by just making sure
we always link the hostnames instead.

This also plugs a leak introduced by the object destruction
refactoring, since deleting hostsmembers() doesn't free() the
host_name field of the hostsmember struct.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Don't free() contact_name from contactsmember when destroying

We assign it from the contact, so free()ing it here means we
will free() it twice.

Signed-off-by: Andreas Ericsson <ae@op5.se>
lib/kvvec: Add silly helper to locate a specific key

The silly helper does a linear lookup of the searched key and returns
its value. It obviously has horrible performance for everything
beyond 10-ish keys and should be used sparingly.

Signed-off-by: Andreas Ericsson <ae@op5.se>
query-handler: Add qh_error()

The qh_error() function is useful when one wants to pass a message
from whatever function we end up creating output in to the caller.

Since we want error messages to be in some sort of standard format,
we might as well add a helper for it.

Signed-off-by: Andreas Ericsson <ae@op5.se>