From: octo Date: Tue, 10 Jan 2006 21:58:22 +0000 (+0000) Subject: Minor changes since I was a little bored ;) X-Git-Tag: collectd-3.6.0~12 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=280f267969dcf5297cbda9dd17a1674ec3242866;p=collectd.git Minor changes since I was a little bored ;) - Corrected ChangeLog - Added comments and TODOs to `configfile.c' - ``corrected'' indentation in `common.c' --- diff --git a/ChangeLog b/ChangeLog index 8b959cdb..f4d3ce2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,8 +3,6 @@ plugins. * A `df' plugin has been added. * A `mysql' plugin has been added. - * A signal handler for SIGTERM has been added. Signal handlers have - been improved, too. 2005-12-18, Version 3.5.1 * The PID-file is now deleted correctly when shutting down the daemon. diff --git a/src/common.c b/src/common.c index 4d93f4aa..43a51a57 100644 --- a/src/common.c +++ b/src/common.c @@ -46,35 +46,51 @@ static char *rra_def[] = static int rra_num = 9; #endif /* HAVE_LIBRRD */ -void -sstrncpy(char *d, const char *s, int len) +void sstrncpy (char *d, const char *s, int len) { - strncpy(d, s, len); - d[len - 1] = 0; + strncpy (d, s, len); + d[len - 1] = '\0'; } -char * -sstrdup(const char *s) +char *sstrdup (const char *s) { - char *r = strdup(s); - if(r == NULL) { - DBG("Not enough memory."); + char *r; + + if((r = strdup (s)) == NULL) + { + DBG ("Not enough memory."); exit(3); } - return r; + + return (r); } -void * -smalloc(size_t size) +void *smalloc (size_t size) { - void *r = malloc(size); - if(r == NULL) { + void *r; + + if ((r = malloc (size)) == NULL) + { DBG("Not enough memory."); exit(3); } + return r; } +#if 0 +void sfree (void **ptr) +{ + if (ptr == NULL) + return; + + if (*ptr != NULL) + free (*ptr); + + *ptr = NULL; +} +#endif + int strsplit (char *string, char **fields, size_t size) { size_t i; diff --git a/src/configfile.c b/src/configfile.c index 9b1b83a1..e3341dd4 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -59,6 +59,10 @@ typedef struct cf_mode_item int mode; } cf_mode_item_t; +/* TODO + * - LogFile + * - DontFork + */ static cf_mode_item_t cf_mode_list[] = { {"Server", NULL, MODE_CLIENT }, @@ -413,7 +417,14 @@ int cf_callback_mode_loadmodule (const char *shortvar, const char *var, return (LC_CBRET_OKAY); } -/* XXX think about how to do the command line stuff */ +/* + * `cf_callback_mode_switch' + * Change the contents of the global variable `operating_mode' + * + * This should be command line options. One *can* do this in the config + * files, but I will not document this. Don't whine abount it not working as + * you expect if you do it anyways. + */ int cf_callback_mode_switch (const char *shortvar, const char *var, const char *arguments, const char *value, lc_flags_t flags, void *extra)