projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Treewide: cleanup whitespace
[collectd.git]
/
src
/
curl_json.c
diff --git
a/src/curl_json.c
b/src/curl_json.c
index
556263f
..
33b1a6f
100644
(file)
--- a/
src/curl_json.c
+++ b/
src/curl_json.c
@@
-474,13
+474,12
@@
static int cj_config_add_key (cj_t *db, /* {{{ */
return (-1);
}
return (-1);
}
- key =
(cj_key_t *) malloc (
sizeof (*key));
+ key =
calloc (1,
sizeof (*key));
if (key == NULL)
{
if (key == NULL)
{
- ERROR ("curl_json plugin:
m
alloc failed.");
+ ERROR ("curl_json plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (key, 0, sizeof (*key));
key->magic = CJ_KEY_MAGIC;
if (strcasecmp ("Key", ci->key) == 0)
key->magic = CJ_KEY_MAGIC;
if (strcasecmp ("Key", ci->key) == 0)
@@
-615,7
+614,7
@@
static int cj_init_curl (cj_t *db) /* {{{ */
if (db->pass != NULL)
credentials_size += strlen (db->pass);
if (db->pass != NULL)
credentials_size += strlen (db->pass);
- db->credentials =
(char *)
malloc (credentials_size);
+ db->credentials = malloc (credentials_size);
if (db->credentials == NULL)
{
ERROR ("curl_json plugin: malloc failed.");
if (db->credentials == NULL)
{
ERROR ("curl_json plugin: malloc failed.");
@@
-667,13
+666,12
@@
static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */
return (-1);
}
return (-1);
}
- db =
(cj_t *) malloc (
sizeof (*db));
+ db =
calloc (1,
sizeof (*db));
if (db == NULL)
{
if (db == NULL)
{
- ERROR ("curl_json plugin:
m
alloc failed.");
+ ERROR ("curl_json plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (db, 0, sizeof (*db));
db->timeout = -1;
db->timeout = -1;
@@
-861,7
+859,7
@@
static void cj_submit (cj_t *db, cj_key_t *key, value_t *value) /* {{{ */
static int cj_sock_perform (cj_t *db) /* {{{ */
{
char errbuf[1024];
static int cj_sock_perform (cj_t *db) /* {{{ */
{
char errbuf[1024];
- struct sockaddr_un sa_unix = {};
+ struct sockaddr_un sa_unix = {
0
};
sa_unix.sun_family = AF_UNIX;
sstrncpy (sa_unix.sun_path, db->sock, sizeof (sa_unix.sun_path));
sa_unix.sun_family = AF_UNIX;
sstrncpy (sa_unix.sun_path, db->sock, sizeof (sa_unix.sun_path));