.gitignore lib/test-{fanout,nsutils} and lib/core

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2750 5f96b256-904b-4d8d-8c98-d829582c6739
core: Fix macro initialization during reloads

When we originally start, the statically defined macro_keys array
is initialized with all zeroes, like the rest of the .bss segment,
but when we get a reload signal, it appears it's sometimes changed,
which caused us to url-encode certain macros that really shouldn't
be url-encoded.

With this patch, we should be able to lay issue 407 to rest for
Nagios 4.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2751 5f96b256-904b-4d8d-8c98-d829582c6739
Forward patch of SVN revision 2752

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2753 5f96b256-904b-4d8d-8c98-d829582c6739
xod: Plug a memory leak in xdata/xodtemplate.c

On soft reloads, we used to leak the bitmaps we created to track
contacts, hosts and services. This patch adds the necessary calls
to get rid of it.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2755 5f96b256-904b-4d8d-8c98-d829582c6739
xod: Make sure we free servicedependency templates

Apparently we forgot to do that earlier. For host dependencies this
doesn't seem to be a problem.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2756 5f96b256-904b-4d8d-8c98-d829582c6739
core: Avoid strdup()'ing group member names

Since we know all string lists are duplicated to kingdom come when
we inherit variable values, read them from config and register
objects, we can at least avoid duplicating them once again here,
cutting down memory used by lots, and allocations even more (making
it far more pleasant to run large configurations through valgrind).

The user-visible feature here is that error messages for non-existant
objects listed as members of some particular group can contain the
location in the configuration where things went south, which is
particularly helpful for larger configurations.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2757 5f96b256-904b-4d8d-8c98-d829582c6739
core: Assign strings rather than copying them when registering objects

This means we avoid one layer of strdup(). Since everything is
already copied from config to pre-objects anyway, and then from
templates to pre-objects, we really needn't bother with it when
creating the real objects too.

This cuts down the number of memory allocations by quite a significant
amount. We still copy everything from services though, since those
are duplicated per-object, and releasing duplicated services would
otherwise lead to heap corruption on double-free when we exit or
reload.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2758 5f96b256-904b-4d8d-8c98-d829582c6739
core: Stop leaking neb-modules on reloads and shutdowns

Only 40-ish bytes per module, but it's good to get valgrind to
shut the hell up.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2759 5f96b256-904b-4d8d-8c98-d829582c6739
core: Make valgrind report leaked and reachable memory more accurately

Mostly for the --verify-config case though, where we have to free
the nebmod lists and some miscellaneous variables.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2760 5f96b256-904b-4d8d-8c98-d829582c6739
xod: Avoid printf() calls

Changing it to a logging call makes a lot more sense.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2761 5f96b256-904b-4d8d-8c98-d829582c6739
core: free() more variables when quitting

While we'd like to get "No leaks possible" from valgrind, we'll
have to settle for the memory my_strtok() allocates and keeps a
pointer to (for now anyways).

We also make sure to assign more of the "runtime constant" macros
from our global variables, to avoid tracking both of them for leaks.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2762 5f96b256-904b-4d8d-8c98-d829582c6739
xod: Launch a massive strike in the war against strdup()

We already get an allocated and duplicated buffer from mmap_fgets(),
so there's no need for us copy it again, and then once more to get
the value part of the variable in a separate string.

Instead, we avoid the two extra copies per object config entry and
simply modify the input in-place.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2763 5f96b256-904b-4d8d-8c98-d829582c6739
xod: Stop segfaulting on contactgroup config verification

Previously we used to segfault when we encountered a contactgroup
with both contacts and contactgroups as members. This patch fixes
that.

Patched-by: Jeff <iamirix@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>
xod: Remove an unused varaible

Shush, gcc, shush...

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