X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmemcachec.c;h=c2147fd51b1f98025d26ec64bd34195495834828;hb=5dcc04778228e4f6b486c3dad585c8ca80c4e72b;hp=19228efef5c7dc4e90c33eba7e72ad84ee1e779c;hpb=2b4445ea9b4b978468d75864f98e8137ba628dec;p=collectd.git diff --git a/src/memcachec.c b/src/memcachec.c index 19228efe..c2147fd5 100644 --- a/src/memcachec.c +++ b/src/memcachec.c @@ -111,29 +111,29 @@ static int cmc_page_init_memc(web_page_t *wp) /* {{{ */ wp->memc = memcached_create(NULL); if (wp->memc == NULL) { ERROR("memcachec plugin: memcached_create failed."); - return (-1); + return -1; } server = memcached_servers_parse(wp->server); memcached_server_push(wp->memc, server); memcached_server_list_free(server); - return (0); + return 0; } /* }}} int cmc_page_init_memc */ static int cmc_config_add_string(const char *name, char **dest, /* {{{ */ oconfig_item_t *ci) { if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) { WARNING("memcachec plugin: `%s' needs exactly one string argument.", name); - return (-1); + return -1; } sfree(*dest); *dest = strdup(ci->values[0].value.string); if (*dest == NULL) - return (-1); + return -1; - return (0); + return 0; } /* }}} int cmc_config_add_string */ static int cmc_config_add_match_dstype(int *dstype_ret, /* {{{ */ @@ -142,7 +142,7 @@ static int cmc_config_add_match_dstype(int *dstype_ret, /* {{{ */ if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) { WARNING("memcachec plugin: `DSType' needs exactly one string argument."); - return (-1); + return -1; } if (strncasecmp("Gauge", ci->values[0].value.string, strlen("Gauge")) == 0) { @@ -175,11 +175,11 @@ static int cmc_config_add_match_dstype(int *dstype_ret, /* {{{ */ if (dstype == 0) { WARNING("memcachec plugin: `%s' is not a valid argument to `DSType'.", ci->values[0].value.string); - return (-1); + return -1; } *dstype_ret = dstype; - return (0); + return 0; } /* }}} int cmc_config_add_match_dstype */ static int cmc_config_add_match(web_page_t *page, /* {{{ */ @@ -194,7 +194,7 @@ static int cmc_config_add_match(web_page_t *page, /* {{{ */ match = calloc(1, sizeof(*match)); if (match == NULL) { ERROR("memcachec plugin: calloc failed."); - return (-1); + return -1; } status = 0; @@ -242,7 +242,7 @@ static int cmc_config_add_match(web_page_t *page, /* {{{ */ if (status != 0) { cmc_web_match_free(match); - return (status); + return status; } match->match = @@ -250,7 +250,7 @@ static int cmc_config_add_match(web_page_t *page, /* {{{ */ if (match->match == NULL) { ERROR("memcachec plugin: match_create_simple failed."); cmc_web_match_free(match); - return (-1); + return -1; } else { web_match_t *prev; @@ -264,7 +264,7 @@ static int cmc_config_add_match(web_page_t *page, /* {{{ */ prev->next = match; } - return (0); + return 0; } /* }}} int cmc_config_add_match */ static int cmc_config_add_page(oconfig_item_t *ci) /* {{{ */ @@ -275,13 +275,13 @@ static int cmc_config_add_page(oconfig_item_t *ci) /* {{{ */ if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) { WARNING( "memcachec plugin: `Page' blocks need exactly one string argument."); - return (-1); + return -1; } page = calloc(1, sizeof(*page)); if (page == NULL) { ERROR("memcachec plugin: calloc failed."); - return (-1); + return -1; } page->server = NULL; page->key = NULL; @@ -290,7 +290,7 @@ static int cmc_config_add_page(oconfig_item_t *ci) /* {{{ */ if (page->instance == NULL) { ERROR("memcachec plugin: strdup failed."); sfree(page); - return (-1); + return -1; } /* Process all children */ @@ -342,7 +342,7 @@ static int cmc_config_add_page(oconfig_item_t *ci) /* {{{ */ if (status != 0) { cmc_web_page_free(page); - return (status); + return status; } /* Add the new page to the linked list */ @@ -357,7 +357,7 @@ static int cmc_config_add_page(oconfig_item_t *ci) /* {{{ */ prev->next = page; } - return (0); + return 0; } /* }}} int cmc_config_add_page */ static int cmc_config(oconfig_item_t *ci) /* {{{ */ @@ -386,19 +386,19 @@ static int cmc_config(oconfig_item_t *ci) /* {{{ */ if ((success == 0) && (errors > 0)) { ERROR("memcachec plugin: All statements failed."); - return (-1); + return -1; } - return (0); + return 0; } /* }}} int cmc_config */ static int cmc_init(void) /* {{{ */ { if (pages_g == NULL) { INFO("memcachec plugin: No pages have been defined."); - return (-1); + return -1; } - return (0); + return 0; } /* }}} int cmc_init */ static void cmc_submit(const web_page_t *wp, const web_match_t *wm, /* {{{ */ @@ -423,14 +423,14 @@ static int cmc_read_page(web_page_t *wp) /* {{{ */ int status; if (wp->memc == NULL) - return (-1); + return -1; wp->buffer = memcached_get(wp->memc, wp->key, strlen(wp->key), &string_length, &flags, &rc); if (rc != MEMCACHED_SUCCESS) { ERROR("memcachec plugin: memcached_get failed: %s", memcached_strerror(wp->memc, rc)); - return (-1); + return -1; } for (web_match_t *wm = wp->matches; wm != NULL; wm = wm->next) { @@ -454,7 +454,7 @@ static int cmc_read_page(web_page_t *wp) /* {{{ */ sfree(wp->buffer); - return (0); + return 0; } /* }}} int cmc_read_page */ static int cmc_read(void) /* {{{ */ @@ -462,7 +462,7 @@ static int cmc_read(void) /* {{{ */ for (web_page_t *wp = pages_g; wp != NULL; wp = wp->next) cmc_read_page(wp); - return (0); + return 0; } /* }}} int cmc_read */ static int cmc_shutdown(void) /* {{{ */ @@ -470,7 +470,7 @@ static int cmc_shutdown(void) /* {{{ */ cmc_web_page_free(pages_g); pages_g = NULL; - return (0); + return 0; } /* }}} int cmc_shutdown */ void module_register(void) {