X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fonewire.c;h=235eff80a8d4663b5e479627db39f3183f99aa21;hb=727a4b977ec6549d94da3f694bf3fe8b0121db58;hp=6cfea0ec1e7cc38c520cbb7f2ccebb5bb49b9437;hpb=f64a8b0906df8f97fbe91f15a919c76b83f93ba9;p=collectd.git diff --git a/src/onewire.c b/src/onewire.c index 6cfea0ec..235eff80 100644 --- a/src/onewire.c +++ b/src/onewire.c @@ -20,6 +20,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" #include "utils_ignorelist.h" @@ -176,11 +177,11 @@ static int direct_list_insert(const char * config) { regmatch_t pmatch[3]; size_t nmatch = 3; - direct_access_element_t *element = NULL; + direct_access_element_t *element; DEBUG ("onewire plugin: direct_list_insert <%s>", config); - element = (direct_access_element_t *) malloc (sizeof(*element)); + element = malloc (sizeof (*element)); if (element == NULL) { ERROR ("onewire plugin: direct_list_insert - cannot allocate element"); @@ -338,7 +339,6 @@ static int cow_read_values (const char *path, const char *name, value_t values[1]; value_list_t vl = VALUE_LIST_INIT; int success = 0; - size_t i; if (sensor_list != NULL) { @@ -354,7 +354,7 @@ static int cow_read_values (const char *path, const char *name, sstrncpy (vl.plugin, "onewire", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, name, sizeof (vl.plugin_instance)); - for (i = 0; i < family_info->features_num; i++) + for (size_t i = 0; i < family_info->features_num; i++) { char *buffer; size_t buffer_size; @@ -384,7 +384,6 @@ static int cow_read_values (const char *path, const char *name, if (endptr == NULL) { ERROR ("onewire plugin: Buffer is not a number: %s", buffer); - status = -1; continue; } @@ -416,11 +415,11 @@ static int cow_read_ds2409 (const char *path) int status; status = ssnprintf (subpath, sizeof (subpath), "%s/main", path); - if ((status > 0) && (status < sizeof (subpath))) + if ((status > 0) && (status < (int) sizeof (subpath))) cow_read_bus (subpath); status = ssnprintf (subpath, sizeof (subpath), "%s/aux", path); - if ((status > 0) && (status < sizeof (subpath))) + if ((status > 0) && (status < (int) sizeof (subpath))) cow_read_bus (subpath); return (0); @@ -460,7 +459,7 @@ static int cow_read_bus (const char *path) else status = ssnprintf (subpath, sizeof (subpath), "%s/%s", path, buffer_ptr); - if ((status <= 0) || (status >= sizeof (subpath))) + if ((status <= 0) || (status >= (int) sizeof (subpath))) continue; for (i = 0; i < ow_family_features_num; i++) @@ -528,7 +527,6 @@ static int cow_simple_read (void) if (endptr == NULL) { ERROR ("onewire plugin: Buffer is not a number: %s", buffer); - status = -1; continue; }