From 55724282b9f55c3a1a52c6402150e3d9a7cbc6f9 Mon Sep 17 00:00:00 2001 From: Martin Nilsson <nilsson@opera.com> Date: Sun, 27 Apr 2014 22:50:24 +0200 Subject: [PATCH] realloc takes void* and doesn't need any cast. --- src/backend.cmod | 5 ++--- src/program.c | 15 +++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/backend.cmod b/src/backend.cmod index 38b909bce4..ea224451c3 100644 --- a/src/backend.cmod +++ b/src/backend.cmod @@ -736,9 +736,8 @@ PIKECLASS Backend struct hash_ent *new_hash; int e; - new_heap = (struct Backend_CallOut_struct **) - realloc((char *)me->call_heap, - sizeof(struct Backend_CallOut_struct *)*me->call_heap_size*2); + new_heap = realloc(me->call_heap, + sizeof(struct Backend_CallOut_struct *)*me->call_heap_size*2); if(!new_heap) Pike_error("Not enough memory for another call_out\n"); MEMSET(new_heap + me->call_heap_size, 0, diff --git a/src/program.c b/src/program.c index 139a8409e9..0fc854ce22 100644 --- a/src/program.c +++ b/src/program.c @@ -1501,8 +1501,7 @@ void PIKE_CONCAT(low_add_to_,NAME) (struct program_state *state, \ return; \ } \ m = MINIMUM(m*2+1,MAXVARS(NUMTYPE)); \ - tmp = mexec_realloc((void *)state->new_program->NAME, \ - sizeof(TYPE) * m); \ + tmp = mexec_realloc(state->new_program->NAME, sizeof(TYPE) * m); \ if(!tmp) Pike_fatal("Out of memory.\n"); \ PIKE_CONCAT(RELOCATE_,NAME)(state->new_program, tmp); \ state->malloc_size_program->PIKE_CONCAT(num_,NAME)=m; \ @@ -1526,8 +1525,7 @@ void PIKE_CONCAT(low_add_many_to_,NAME) (struct program_state *state, \ n = MINIMUM(n*2+1,MAXVARS(NUMTYPE)); \ } while (m + cnt > n); \ m = n; \ - tmp = mexec_realloc((void *)state->new_program->NAME, \ - sizeof(TYPE) * m); \ + tmp = mexec_realloc(state->new_program->NAME, sizeof(TYPE) * m); \ if(!tmp) Pike_fatal("Out of memory.\n"); \ PIKE_CONCAT(RELOCATE_,NAME)(state->new_program, tmp); \ state->malloc_size_program->PIKE_CONCAT(num_,NAME)=m; \ @@ -1559,8 +1557,7 @@ void PIKE_CONCAT(add_to_,NAME) (ARGTYPE ARG) { \ n = MINIMUM(n*2+1,MAXVARS(NUMTYPE)); \ } while (m + cnt > n); \ m = n; \ - tmp = realloc((void *)state->new_program->NAME, \ - sizeof(TYPE) * m); \ + tmp = realloc(state->new_program->NAME, sizeof(TYPE) * m); \ if(!tmp) Pike_fatal("Out of memory.\n"); \ PIKE_CONCAT(RELOCATE_,NAME)(state->new_program, tmp); \ state->malloc_size_program->PIKE_CONCAT(num_,NAME)=m; \ @@ -1587,8 +1584,7 @@ void PIKE_CONCAT(low_add_to_,NAME) (struct program_state *state, \ return; \ } \ m = MINIMUM(m*2+1,MAXVARS(NUMTYPE)); \ - tmp = realloc((void *)state->new_program->NAME, \ - sizeof(TYPE) * m); \ + tmp = realloc(state->new_program->NAME, sizeof(TYPE) * m); \ if(!tmp) Pike_fatal("Out of memory.\n"); \ PIKE_CONCAT(RELOCATE_,NAME)(state->new_program, tmp); \ state->malloc_size_program->PIKE_CONCAT(num_,NAME)=m; \ @@ -1619,8 +1615,7 @@ void PIKE_CONCAT(low_add_to_,NAME) (struct program_state *state, \ return; \ } \ m = MINIMUM(m*2+1,MAXVARS(NUMTYPE)); \ - tmp = realloc((void *)state->new_program->NAME, \ - sizeof(TYPE) * m); \ + tmp = realloc(state->new_program->NAME, sizeof(TYPE) * m); \ if(!tmp) Pike_fatal("Out of memory.\n"); \ PIKE_CONCAT(RELOCATE_,NAME)(state->new_program, tmp); \ state->malloc_size_program->PIKE_CONCAT(num_,NAME)=m; \ -- GitLab