]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove unnecessary casts on malloc return values
authorNathan Moinvaziri <nathan@nathanm.com>
Wed, 11 Feb 2026 19:32:42 +0000 (11:32 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 17 Feb 2026 16:29:13 +0000 (17:29 +0100)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 4161f7d0eb58

gzlib.c
zutil_p.h

diff --git a/gzlib.c b/gzlib.c
index 016a0a6dbe881500cd71de850911b1ec0946858f..05f46d9610bf0cbed6f4365a0e1c6d89b40128d4 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -204,7 +204,7 @@ static gzFile gz_open(const void *path, int fd, const char *mode) {
     } else
 #endif
         len = strlen((const char *)path);
-    state->path = (char *)malloc(len + 1);
+    state->path = malloc(len + 1);
     if (state->path == NULL) {
         gz_state_free(state);
         return NULL;
@@ -577,7 +577,7 @@ void Z_INTERNAL PREFIX(gz_error)(gz_state *state, int err, const char *msg) {
         return;
 
     /* construct error message with path */
-    if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) {
+    if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) {
         state->err = Z_MEM_ERROR;
         return;
     }
index 866a52f639293e6fceac93445c76f16212ede1cb..96159563508985afffc596d90fde79f29ad4f05e 100644 (file)
--- a/zutil_p.h
+++ b/zutil_p.h
@@ -10,7 +10,7 @@
 // Zlib-ng's default alloc/free implementation, used unless
 // application supplies its own alloc/free functions.
 static inline void *zng_alloc(size_t size) {
-    return (void *)malloc(size);
+    return malloc(size);
 }
 
 static inline void zng_free(void *ptr) {