X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fdaemon%2Fconfigfile.c;h=5f49a9e6fc0848d1ff2975e696d3e87e39ae12b9;hb=1ebf2f31bd2e080e6f42de640f0a3899a61501c0;hp=8a7621d2b5fb912b02d64c8c9f86456d42dbea08;hpb=6894d846ac42cbe88073db074d75279f5a6e31b8;p=collectd.git diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index 8a7621d2..5f49a9e6 100644 --- a/src/daemon/configfile.c +++ b/src/daemon/configfile.c @@ -717,7 +717,7 @@ static oconfig_item_t *cf_read_dir (const char *dir, return (NULL); } - root = (oconfig_item_t *) malloc (sizeof (oconfig_item_t)); + root = malloc (sizeof (*root)); if (root == NULL) { ERROR ("configfile: malloc failed."); @@ -835,7 +835,7 @@ static oconfig_item_t *cf_read_generic (const char *path, return (NULL); } - root = (oconfig_item_t *) malloc (sizeof (oconfig_item_t)); + root = malloc (sizeof (*root)); 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' */ - 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; @@ -1084,7 +1084,7 @@ int cf_register_complex (const char *type, int (*callback) (oconfig_item_t *)) { 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);