core: Bail out when we fail to read the resource file

It should be a fatal error, so let's make it so.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2711 5f96b256-904b-4d8d-8c98-d829582c6739
cgi/cmd.c: add explicit type for function parameter

Defaulting to int generates warnings. Setting it explicitly is fine.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2712 5f96b256-904b-4d8d-8c98-d829582c6739
Janit patch: Remove redundant declarations

gcc -Wredundant-decls reports a bunch. This gets rid of them,
making the code a bit more maintainable.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2713 5f96b256-904b-4d8d-8c98-d829582c6739
core: Remove debug printf() statement

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2714 5f96b256-904b-4d8d-8c98-d829582c6739
Don't use declarations after statements

It causes compilers that only support C90 to bail out hard and makes
gcc pretty noisy when extra warnings are enabled, so let's avoid it.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2715 5f96b256-904b-4d8d-8c98-d829582c6739
Fix -Wmissing-prototypes warnings

We do this by defining the offending functions as static, thus
removing them from the global scope. This lets the compiler
optimize better, so it's not just about making gcc shut up.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2716 5f96b256-904b-4d8d-8c98-d829582c6739
Remove unused function parameters

Some functions take parameters that are never used, or are only
used for passing to leaf functions which don't use them. This
removes most of the ones I could easily find, but only where it's
safe to do so with regards to API and ABI compatibility, so the
xdata stuff (which isn't publicly exported to modules) and a lot
of initialization and cleanup functions (which modules aren't
supposed to run anyway) are modified. And CGI's, ofcourse.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Janitor patch: Remove trailing newlines in files

Silly, but helpful when counting codelines.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Janitor patch: Remove trailing whitespace from lines

Editors should remove them when saving, and most do, but that
tends to clutter up the diff output, so let's purge the evilness
in a single commit instead.

We only touch .c and .h files though, since whitespace has
semantic meaning for Makefiles and is useful to be able to add
to test-files and suchlike.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Stop shadowing variables, types and functions

It's most often done with variables that are of the same type,
which means renaming them will cause some variable accesses to
access the global variable while others may use the local one.
Such bugs are generally nearly impossible to track down, since
one has to follow the actual logic to figure out which variable
is intended to be used (after all; The whole point of global vars
is that they can be used from anywhere).

Detected with -Wshadow option to gcc.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Declare const strings as const

This allows the compiler to optimize things better. Function calls
in particular benefit hugely from this.

As a nice sideeffect, we get a neat hint about which functions
have a tendency to modify their arguments and which don't.

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