Skip to content

Commit b9a22d6

Browse files
nmoinvazclaude
authored andcommitted
Remove unnecessary casts on malloc return values
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 4161f7d0eb58
1 parent faa8386 commit b9a22d6

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

gzlib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static gzFile gz_open(const void *path, int fd, const char *mode) {
204204
} else
205205
#endif
206206
len = strlen((const char *)path);
207-
state->path = (char *)malloc(len + 1);
207+
state->path = malloc(len + 1);
208208
if (state->path == NULL) {
209209
gz_state_free(state);
210210
return NULL;
@@ -577,7 +577,7 @@ void Z_INTERNAL PREFIX(gz_error)(gz_state *state, int err, const char *msg) {
577577
return;
578578

579579
/* construct error message with path */
580-
if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) {
580+
if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) {
581581
state->err = Z_MEM_ERROR;
582582
return;
583583
}

zutil_p.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Zlib-ng's default alloc/free implementation, used unless
1111
// application supplies its own alloc/free functions.
1212
static inline void *zng_alloc(size_t size) {
13-
return (void *)malloc(size);
13+
return malloc(size);
1414
}
1515

1616
static inline void zng_free(void *ptr) {

0 commit comments

Comments
 (0)