Use constants for logging verbosity instead of magic numbers. Note: checkpatch.pl complains about initialization of VERBOSITY_MIN to 0, what to do about it?
Signed-off-by: Jan Safranek <[email protected]> --- cgrulesengd.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cgrulesengd.c b/cgrulesengd.c index 3a30476..09056b6 100644 --- a/cgrulesengd.c +++ b/cgrulesengd.c @@ -52,6 +52,15 @@ #include <linux/connector.h> #include <linux/cn_proc.h> +/* Minimal vebosity level */ +const int VERBOSITY_MIN = 0; + +/* Default log level */ +const int VERBOSITY_DEFAULT = 2; + +/* Maximal log level */ +const int VERBOSITY_MAX = 4; + /* Log file, NULL if logging to file is disabled */ FILE* logfile; @@ -632,7 +641,7 @@ int main(int argc, char *argv[]) int facility = 0; /* Verbose level */ - int verbosity = 2; + int verbosity = VERBOSITY_DEFAULT; /* For catching signals */ struct sigaction sa; @@ -687,7 +696,7 @@ int main(int argc, char *argv[]) break; case 'Q': /* --nolog */ - verbosity = 0; + verbosity = VERBOSITY_MIN; break; case 'f': /* --logfile=<filename> */ @@ -716,7 +725,7 @@ int main(int argc, char *argv[]) case 'd': /* --debug */ /* same as -vvn */ daemon = 0; - verbosity = 4; + verbosity = VERBOSITY_MAX; logp = "-"; break; ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Libcg-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libcg-devel
