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
/
configfile.c
diff --git
a/src/daemon/configfile.c
b/src/daemon/configfile.c
index
89b0be0
..
5f49a9e
100644
(file)
--- a/
src/daemon/configfile.c
+++ b/
src/daemon/configfile.c
@@
-72,15
+72,15
@@
typedef struct cf_complex_callback_s
typedef struct cf_value_map_s
{
typedef struct cf_value_map_s
{
- char *key;
+ c
onst c
har *key;
int (*func) (oconfig_item_t *);
} cf_value_map_t;
typedef struct cf_global_option_s
{
int (*func) (oconfig_item_t *);
} cf_value_map_t;
typedef struct cf_global_option_s
{
- char *key;
+ c
onst c
har *key;
char *value;
char *value;
- char *def;
+ c
onst c
har *def;
} cf_global_option_t;
/*
} cf_global_option_t;
/*
@@
-381,7
+381,7
@@
static int dispatch_value (oconfig_item_t *ci)
static int dispatch_block_plugin (oconfig_item_t *ci)
{
int i;
static int dispatch_block_plugin (oconfig_item_t *ci)
{
int i;
- char *name;
+ c
onst c
har *name;
cf_complex_callback_t *cb;
cf_complex_callback_t *cb;
@@
-717,7
+717,7
@@
static oconfig_item_t *cf_read_dir (const char *dir,
return (NULL);
}
return (NULL);
}
- root =
(oconfig_item_t *) malloc (sizeof (oconfig_item_
t));
+ root =
malloc (sizeof (*roo
t));
if (root == NULL)
{
ERROR ("configfile: malloc failed.");
if (root == NULL)
{
ERROR ("configfile: malloc failed.");
@@
-835,7
+835,7
@@
static oconfig_item_t *cf_read_generic (const char *path,
return (NULL);
}
return (NULL);
}
- root =
(oconfig_item_t *) malloc (sizeof (oconfig_item_
t));
+ root =
malloc (sizeof (*roo
t));
if (root == NULL)
{
ERROR ("configfile: malloc failed.");
if (root == NULL)
{
ERROR ("configfile: malloc failed.");
@@
-1067,7
+1067,7
@@
void cf_register (const char *type,
cf_unregister (type);
/* This pointer will be free'd in `cf_unregister' */
cf_unregister (type);
/* This pointer will be free'd in `cf_unregister' */
- if ((cf_cb =
(cf_callback_t *) malloc (sizeof (cf_callback_t
))) == NULL)
+ if ((cf_cb =
malloc (sizeof (*cf_cb
))) == NULL)
return;
cf_cb->type = type;
return;
cf_cb->type = type;
@@
-1084,7
+1084,7
@@
int cf_register_complex (const char *type, int (*callback) (oconfig_item_t *))
{
cf_complex_callback_t *new;
{
cf_complex_callback_t *new;
- new =
(cf_complex_callback_t *) malloc (sizeof (cf_complex_callback_t
));
+ new =
malloc (sizeof (*new
));
if (new == NULL)
return (-1);
if (new == NULL)
return (-1);
@@
-1115,7
+1115,7
@@
int cf_register_complex (const char *type, int (*callback) (oconfig_item_t *))
return (0);
} /* int cf_register_complex */
return (0);
} /* int cf_register_complex */
-int cf_read (char *filename)
+int cf_read (c
onst c
har *filename)
{
oconfig_item_t *conf;
int i;
{
oconfig_item_t *conf;
int i;