netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Sowden <jeremy@azazel.net>
To: Netfilter Devel <netfilter-devel@vger.kernel.org>
Subject: [PATCH ulogd2 v2 v2 11/34] src: remove superfluous casts
Date: Tue, 29 Nov 2022 21:47:26 +0000	[thread overview]
Message-ID: <20221129214749.247878-12-jeremy@azazel.net> (raw)
In-Reply-To: <20221129214749.247878-1-jeremy@azazel.net>

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(-)

diff --git a/cftest/cftest.c b/cftest/cftest.c
index b99882be5840..b16e75a5a451 100644
--- a/cftest/cftest.c
+++ b/cftest/cftest.c
@@ -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);
 
diff --git a/libipulog/libipulog.c b/libipulog/libipulog.c
index b49f7f2cbd79..371c0d7622d6 100644
--- a/libipulog/libipulog.c
+++ b/libipulog/libipulog.c
@@ -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;
diff --git a/libipulog/ulog_test.c b/libipulog/ulog_test.c
index 06657172a0cd..6b796d064992 100644
--- a/libipulog/ulog_test.c
+++ b/libipulog/ulog_test.c
@@ -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])));
diff --git a/src/conffile.c b/src/conffile.c
index 66769decc93c..8a208d6d8cfe 100644
--- a/src/conffile.c
+++ b/src/conffile.c
@@ -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;
 
diff --git a/src/hash.c b/src/hash.c
index 1d991309734f..2f7f5deebece 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -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;
diff --git a/src/ulogd.c b/src/ulogd.c
index ec0745e63169..82f936168ebc 100644
--- a/src/ulogd.c
+++ b/src/ulogd.c
@@ -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;
diff --git a/util/db.c b/util/db.c
index fb41266648d5..6749079697dc 100644
--- a/util/db.c
+++ b/util/db.c
@@ -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;
 
-- 
2.35.1


  parent reply	other threads:[~2022-11-29 21:58 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 21:47 [PATCH ulogd2 v2 v2 00/34] Refactor of the DB output plug-ins Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 01/34] ulogd: fix parse-error check Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 02/34] filter: fix buffer sizes in filter plug-ins Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 03/34] output: JSON: remove incorrect config value check Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 04/34] db: fix back-log capacity checks Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 05/34] build: add checks to configure.ac Jeremy Sowden
2022-11-30 10:04   ` Jan Engelhardt
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 06/34] src: remove some trailing white space Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 07/34] src: remove zero-valued config-key fields Jeremy Sowden
2022-11-30 10:21   ` Jan Engelhardt
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 08/34] src: parenthesize config-entry macro arguments Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 09/34] src: define constructors and destructors consistently Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 10/34] src: remove `TIME_ERR` macro Jeremy Sowden
2022-11-29 21:47 ` Jeremy Sowden [this message]
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 12/34] conffile: replace malloc+strcpy with strdup Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 13/34] output: remove zero-initialized `struct ulogd_plugin` members Jeremy Sowden
2022-11-30 10:26   ` Jan Engelhardt
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 14/34] output: de-duplicate allocation of input keys Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 15/34] db: reorganize source Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 16/34] db: use consistent integer return values to indicate errors Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 17/34] db: change return type of two functions to `void` Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 18/34] db: open-code `_loop_reconnect_db` Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 19/34] db: improve calculation of sql statement length Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 20/34] db: refactor configuration Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 21/34] db: refactor ring-buffer initialization Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 22/34] db: refactor ring-buffer Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 23/34] db: refactor backlog Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 24/34] db: use `struct db_stmt` objects more widely Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 25/34] db: synchronize access to ring-buffer Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 26/34] db: avoid cancelling ring-buffer thread Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 27/34] db, IP2BIN: defer formatting of raw strings Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 28/34] db: add prep & exec support Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 29/34] output: mysql: " Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 30/34] output: pgsql: remove a couple of struct members Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 31/34] output: pgsql: remove variable-length arrays Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 32/34] output: pgsql: tidy up `open_db_pgsql` and fix memory leak Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 33/34] output: pgsql: add prep & exec support Jeremy Sowden
2022-11-29 21:47 ` [PATCH ulogd2 v2 v2 34/34] output: sqlite3: reimplement using the common DB API Jeremy Sowden
2022-11-30 10:27 ` [PATCH ulogd2 v2 v2 00/34] Refactor of the DB output plug-ins Pablo Neira Ayuso
2022-11-30 16:03   ` Jeremy Sowden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221129214749.247878-12-jeremy@azazel.net \
    --to=jeremy@azazel.net \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).