From: Florian Forster Date: Wed, 29 Sep 2010 15:47:19 +0000 (+0200) Subject: src/utils_cache.c: Improve a couple of comments. X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=3bde7865d5719abe7bd3c70f9b6492d202f6f4e0;p=collectd.git src/utils_cache.c: Improve a couple of comments. --- diff --git a/src/utils_cache.c b/src/utils_cache.c index 2e33ab08..b7eacf3d 100644 --- a/src/utils_cache.c +++ b/src/utils_cache.c @@ -121,6 +121,7 @@ static void cache_free (cache_entry_t *ce) sfree (ce); } /* void cache_free */ +/* Send out notifications for "missing" values. */ static int uc_send_notification (const char *name) { cache_entry_t *ce = NULL; @@ -155,8 +156,9 @@ static int uc_send_notification (const char *name) return (-1); } - memset (&ds, '\0', sizeof (ds)); - memset (&vl, '\0', sizeof (vl)); + memset (&ds, 0, sizeof (ds)); + memset (&vl, 0, sizeof (vl)); + sstrncpy (vl.host, host, sizeof (vl.host)); sstrncpy (vl.plugin, plugin, sizeof (vl.plugin)); if (plugin_instance != NULL) @@ -166,7 +168,6 @@ static int uc_send_notification (const char *name) if (type_instance != NULL) sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); - /* Copy the associative members */ notification_init (&n, NOTIF_FAILURE, /* host = */ NULL, host, plugin, plugin_instance, type, type_instance); @@ -192,7 +193,8 @@ static int uc_send_notification (const char *name) return (-1); } - /* Check if the entry has been updated in the meantime */ + /* Check if the entry has been updated since we marked it as "missing" in + * uc_check_timeout() */ if ((n.time - ce->last_update) < (2 * ce->interval)) { ce->state = STATE_OKAY;