projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src/Makefile: Don't set subdir-objects.
[collectd.git]
/
src
/
curl.c
diff --git
a/src/curl.c
b/src/curl.c
index
ac4cc51
..
7f298a2
100644
(file)
--- a/
src/curl.c
+++ b/
src/curl.c
@@
-95,7
+95,7
@@
static size_t cc_curl_callback (void *buf, /* {{{ */
size_t len;
len = size * nmemb;
size_t len;
len = size * nmemb;
- if (len
<
= 0)
+ if (len
=
= 0)
return (len);
wp = user_data;
return (len);
wp = user_data;
@@
-108,7
+108,7
@@
static size_t cc_curl_callback (void *buf, /* {{{ */
size_t temp_size;
temp_size = wp->buffer_fill + len + 1;
size_t temp_size;
temp_size = wp->buffer_fill + len + 1;
- temp =
(char *)
realloc (wp->buffer, temp_size);
+ temp = realloc (wp->buffer, temp_size);
if (temp == NULL)
{
ERROR ("curl plugin: realloc failed.");
if (temp == NULL)
{
ERROR ("curl plugin: realloc failed.");
@@
-167,16
+167,19
@@
static void cc_web_page_free (web_page_t *wp) /* {{{ */
static int cc_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
oconfig_item_t *ci)
{
static int cc_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
oconfig_item_t *ci)
{
+ struct curl_slist *temp = NULL;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl plugin: `%s' needs exactly one string argument.", name);
return (-1);
}
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl plugin: `%s' needs exactly one string argument.", name);
return (-1);
}
-
*dest
= curl_slist_append(*dest, ci->values[0].value.string);
- if (
*dest
== NULL)
+
temp
= curl_slist_append(*dest, ci->values[0].value.string);
+ if (
temp
== NULL)
return (-1);
return (-1);
+ *dest = temp;
+
return (0);
} /* }}} int cc_config_append_string */
return (0);
} /* }}} int cc_config_append_string */
@@
-270,13
+273,12
@@
static int cc_config_add_match (web_page_t *page, /* {{{ */
WARNING ("curl plugin: Ignoring arguments for the `Match' block.");
}
WARNING ("curl plugin: Ignoring arguments for the `Match' block.");
}
- match =
(web_match_t *) malloc (
sizeof (*match));
+ match =
calloc (1,
sizeof (*match));
if (match == NULL)
{
if (match == NULL)
{
- ERROR ("curl plugin:
m
alloc failed.");
+ ERROR ("curl plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (match, 0, sizeof (*match));
status = 0;
for (i = 0; i < ci->children_num; i++)
status = 0;
for (i = 0; i < ci->children_num; i++)
@@
-388,7
+390,7
@@
static int cc_page_init_curl (web_page_t *wp) /* {{{ */
if (wp->pass != NULL)
credentials_size += strlen (wp->pass);
if (wp->pass != NULL)
credentials_size += strlen (wp->pass);
- wp->credentials =
(char *)
malloc (credentials_size);
+ wp->credentials = malloc (credentials_size);
if (wp->credentials == NULL)
{
ERROR ("curl plugin: malloc failed.");
if (wp->credentials == NULL)
{
ERROR ("curl plugin: malloc failed.");
@@
-418,8
+420,7
@@
static int cc_page_init_curl (web_page_t *wp) /* {{{ */
if (wp->timeout >= 0)
curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, (long) wp->timeout);
else
if (wp->timeout >= 0)
curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, (long) wp->timeout);
else
- curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS,
- CDTIME_T_TO_MS(plugin_get_interval()));
+ curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, (long) CDTIME_T_TO_MS(plugin_get_interval()));
#endif
return (0);
#endif
return (0);
@@
-437,13
+438,12
@@
static int cc_config_add_page (oconfig_item_t *ci) /* {{{ */
return (-1);
}
return (-1);
}
- page =
(web_page_t *) malloc (
sizeof (*page));
+ page =
calloc (1,
sizeof (*page));
if (page == NULL)
{
if (page == NULL)
{
- ERROR ("curl plugin:
m
alloc failed.");
+ ERROR ("curl plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (page, 0, sizeof (*page));
page->url = NULL;
page->user = NULL;
page->pass = NULL;
page->url = NULL;
page->user = NULL;
page->pass = NULL;
@@
-543,7
+543,7
@@
static int cc_config_add_page (oconfig_item_t *ci) /* {{{ */
web_page_t *prev;
prev = pages_g;
web_page_t *prev;
prev = pages_g;
- while (
(prev != NULL) && (prev->next != NULL)
)
+ while (
prev->next != NULL
)
prev = prev->next;
prev->next = page;
}
prev = prev->next;
prev->next = page;
}