@@ -19,7 +19,7 @@ int main()
strcpy(f.key, "spalte");
f.type = CONFIG_TYPE_STRING;
f.options |= CONFIG_OPT_MANDATORY;
- f.u.str.string = (char *) malloc(100);
+ f.u.str.string = malloc(100);
f.u.str.maxlen = 99;
config_register_key(&f);
@@ -129,7 +129,7 @@ struct ipulog_handle *ipulog_create_handle(uint32_t gmask,
struct ipulog_handle *h;
int status;
- h = (struct ipulog_handle *) malloc(sizeof(struct ipulog_handle));
+ h = malloc(sizeof(*h));
if (h == NULL)
{
ipulog_errno = IPULOG_ERR_HANDLE;
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
}
/* allocate a receive buffer */
- buf = (unsigned char *) malloc(MYBUFSIZ);
+ buf = malloc(MYBUFSIZ);
/* create ipulog handle */
h = ipulog_create_handle(ipulog_group2gmask(atoi(argv[2])));
@@ -104,7 +104,7 @@ int config_register_file(const char *file)
pr_debug("%s: registered config file '%s'\n", __func__, file);
- fname = (char *) malloc(strlen(file)+1);
+ fname = malloc(strlen(file)+1);
if (!fname)
return -ERROOM;
@@ -34,9 +34,9 @@ hashtable_create(int hashsize, int limit,
int i;
struct hashtable *h;
int size = sizeof(struct hashtable)
- + hashsize * sizeof(struct llist_head);
+ + sizeof(struct llist_head) * hashsize;
- h = (struct hashtable *) calloc(size, 1);
+ h = calloc(size, 1);
if (h == NULL) {
errno = ENOMEM;
return NULL;
@@ -720,7 +720,7 @@ static int load_plugin(const char *file)
return -1;
}
- ph = (struct ulogd_plugin_handle *) calloc(1, sizeof(*ph));
+ ph = calloc(1, sizeof(*ph));
ph->handle = handle;
llist_add(&ph->list, &ulogd_plugins_handle);
return 0;
@@ -85,7 +85,7 @@ static int sql_createstmt(struct ulogd_pluginstance *upi)
ulogd_log(ULOGD_DEBUG, "allocating %u bytes for statement\n", size);
- mi->stmt = (char *) malloc(size);
+ mi->stmt = malloc(size);
if (!mi->stmt) {
ulogd_log(ULOGD_ERROR, "OOM!\n");
return -ENOMEM;
@@ -575,7 +575,7 @@ static int __loop_reconnect_db(struct ulogd_pluginstance * upi) {
static void *__inject_thread(void *gdi)
{
- struct ulogd_pluginstance *upi = (struct ulogd_pluginstance *) gdi;
+ struct ulogd_pluginstance *upi = gdi;
struct db_instance *di = (struct db_instance *) &upi->private;
char *wr_place;
We're not writing C++, we don't need to cast void pointers. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> --- cftest/cftest.c | 2 +- libipulog/libipulog.c | 2 +- libipulog/ulog_test.c | 2 +- src/conffile.c | 2 +- src/hash.c | 4 ++-- src/ulogd.c | 2 +- util/db.c | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-)