projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1807 from matteocontrini/master
[collectd.git]
/
src
/
libcollectdclient
/
client.c
diff --git
a/src/libcollectdclient/client.c
b/src/libcollectdclient/client.c
index
0f56bd2
..
77fd576
100644
(file)
--- a/
src/libcollectdclient/client.c
+++ b/
src/libcollectdclient/client.c
@@
-287,7
+287,7
@@
static int lcc_receive (lcc_connection_t *c, /* {{{ */
* beginning of the message. */
ptr = NULL;
errno = 0;
* beginning of the message. */
ptr = NULL;
errno = 0;
- res.status = strtol (buffer, &ptr, 0);
+ res.status =
(int)
strtol (buffer, &ptr, 0);
if ((errno != 0) || (ptr == &buffer[0]))
{
lcc_set_errno (c, errno);
if ((errno != 0) || (ptr == &buffer[0]))
{
lcc_set_errno (c, errno);
@@
-312,7
+312,7
@@
static int lcc_receive (lcc_connection_t *c, /* {{{ */
/* Allocate space for the char-pointers */
res.lines_num = (size_t) res.status;
res.status = 0;
/* Allocate space for the char-pointers */
res.lines_num = (size_t) res.status;
res.status = 0;
- res.lines =
(char **) malloc (res.lines_num * sizeof (char *
));
+ res.lines =
malloc (res.lines_num * sizeof (*res.lines
));
if (res.lines == NULL)
{
lcc_set_errno (c, ENOMEM);
if (res.lines == NULL)
{
lcc_set_errno (c, ENOMEM);
@@
-584,10
+584,9
@@
int lcc_connect (const char *address, lcc_connection_t **ret_con) /* {{{ */
if (ret_con == NULL)
return (-1);
if (ret_con == NULL)
return (-1);
- c =
(lcc_connection_t *) malloc (
sizeof (*c));
+ c =
calloc (1,
sizeof (*c));
if (c == NULL)
return (-1);
if (c == NULL)
return (-1);
- memset (c, 0, sizeof (*c));
status = lcc_open_socket (c, address);
if (status != 0)
status = lcc_open_socket (c, address);
if (status != 0)
@@
-687,14
+686,14
@@
int lcc_getval (lcc_connection_t *c, lcc_identifier_t *ident, /* {{{ */
/* Allocate space for the values */
if (ret_values != NULL)
{
/* Allocate space for the values */
if (ret_values != NULL)
{
- values =
(gauge_t *)
malloc (values_num * sizeof (*values));
+ values = malloc (values_num * sizeof (*values));
if (values == NULL)
BAIL_OUT (ENOMEM);
}
if (ret_values_names != NULL)
{
if (values == NULL)
BAIL_OUT (ENOMEM);
}
if (ret_values_names != NULL)
{
- values_names =
(char **)
calloc (values_num, sizeof (*values_names));
+ values_names = calloc (values_num, sizeof (*values_names));
if (values_names == NULL)
BAIL_OUT (ENOMEM);
}
if (values_names == NULL)
BAIL_OUT (ENOMEM);
}
@@
-894,7
+893,7
@@
int lcc_listval (lcc_connection_t *c, /* {{{ */
}
ident_num = res.lines_num;
}
ident_num = res.lines_num;
- ident =
(lcc_identifier_t *)
malloc (ident_num * sizeof (*ident));
+ ident = malloc (ident_num * sizeof (*ident));
if (ident == NULL)
{
lcc_response_free (&res);
if (ident == NULL)
{
lcc_response_free (&res);
@@
-1063,9
+1062,11
@@
int lcc_string_to_identifier (lcc_connection_t *c, /* {{{ */
return (0);
} /* }}} int lcc_string_to_identifier */
return (0);
} /* }}} int lcc_string_to_identifier */
-int lcc_identifier_compare (const
lcc_identifier_t *i0
, /* {{{ */
- const
lcc_identifier_t *i1
)
+int lcc_identifier_compare (const
void *a
, /* {{{ */
+ const
void *b
)
{
{
+ const lcc_identifier_t *i0 = a;
+ const lcc_identifier_t *i1 = b;
int status;
if ((i0 == NULL) && (i1 == NULL))
int status;
if ((i0 == NULL) && (i1 == NULL))
@@
-1102,7
+1103,7
@@
int lcc_sort_identifiers (lcc_connection_t *c, /* {{{ */
}
qsort (idents, idents_num, sizeof (*idents),
}
qsort (idents, idents_num, sizeof (*idents),
-
(void *)
lcc_identifier_compare);
+ lcc_identifier_compare);
return (0);
} /* }}} int lcc_sort_identifiers */
return (0);
} /* }}} int lcc_sort_identifiers */