projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
treewide: cleanup malloc calls
[collectd.git]
/
src
/
daemon
/
utils_cache.c
diff --git
a/src/daemon/utils_cache.c
b/src/daemon/utils_cache.c
index
e2c6426
..
7f0d228
100644
(file)
--- a/
src/daemon/utils_cache.c
+++ b/
src/daemon/utils_cache.c
@@
-83,7
+83,7
@@
static cache_entry_t *cache_alloc (size_t values_num)
{
cache_entry_t *ce;
{
cache_entry_t *ce;
- ce =
(cache_entry_t *) malloc (sizeof (cache_entry_t
));
+ ce =
malloc (sizeof (*ce
));
if (ce == NULL)
{
ERROR ("utils_cache: cache_alloc: malloc failed.");
if (ce == NULL)
{
ERROR ("utils_cache: cache_alloc: malloc failed.");
@@
-499,7
+499,7
@@
int uc_get_rate_by_name (const char *name, gauge_t **ret_values, size_t *ret_val
else
{
ret_num = ce->values_num;
else
{
ret_num = ce->values_num;
- ret =
(gauge_t *) malloc (ret_num * sizeof (gauge_
t));
+ ret =
malloc (ret_num * sizeof (*re
t));
if (ret == NULL)
{
ERROR ("utils_cache: uc_get_rate_by_name: malloc failed.");
if (ret == NULL)
{
ERROR ("utils_cache: uc_get_rate_by_name: malloc failed.");
@@
-559,7
+559,7
@@
gauge_t *uc_get_rate (const data_set_t *ds, const value_list_t *vl)
return (ret);
} /* gauge_t *uc_get_rate */
return (ret);
} /* gauge_t *uc_get_rate */
-size_t uc_get_size
(
) {
+size_t uc_get_size
(void
) {
size_t size_arrays = 0;
pthread_mutex_lock (&cache_lock);
size_t size_arrays = 0;
pthread_mutex_lock (&cache_lock);
@@
-736,7
+736,6
@@
int uc_get_history_by_name (const char *name,
if (ce->history_length < num_steps)
{
gauge_t *tmp;
if (ce->history_length < num_steps)
{
gauge_t *tmp;
- size_t i;
tmp = realloc (ce->history, sizeof (*ce->history)
* num_steps * ce->values_num);
tmp = realloc (ce->history, sizeof (*ce->history)
* num_steps * ce->values_num);