Mercurial > mplayer.hg
diff asxparser.c @ 30702:9fc9d1e788aa
Do not cast the results of malloc/calloc/realloc.
These functions return void*, which is compatible with any pointer,
so there is no need for casts.
author | diego |
---|---|
date | Fri, 26 Feb 2010 15:01:37 +0000 |
parents | d218228dc74d |
children | dd2e39036f3c |
line wrap: on
line diff
--- a/asxparser.c Fri Feb 26 12:49:49 2010 +0000 +++ b/asxparser.c Fri Feb 26 15:01:37 2010 +0000 @@ -44,7 +44,7 @@ if(list != NULL) for( ; list[c] != NULL; c++) ; - list = (void*)realloc(list,sizeof(void*)*(c+2)); + list = realloc(list, sizeof(void*) * (c + 2)); list[c] = entry; list[c+1] = NULL; @@ -77,7 +77,7 @@ if(c > e) // If c==e the memmove is not needed memmove(list+e,list+e+1,(c-e)*sizeof(void*)); - list = (void*)realloc(list,(c-1)*sizeof(void*)); + list = realloc(list, (c - 1) * sizeof(void*)); list[c-1] = NULL; *(void***)list_ptr = list; @@ -186,7 +186,7 @@ val[ptr2-ptr1] = '\0'; n_attrib++; - attribs = (char**)realloc(attribs,(2*n_attrib+1)*sizeof(char*)); + attribs = realloc(attribs, (2 * n_attrib + 1) * sizeof(char*)); attribs[n_attrib*2-2] = attrib; attribs[n_attrib*2-1] = val; @@ -241,7 +241,7 @@ memmove(parser->ret_stack,parser->ret_stack+i, (parser->ret_stack_size - i)*sizeof(ASX_LineSave_t)); parser->ret_stack_size -= i; if(parser->ret_stack_size > 0) - parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); + parser->ret_stack = realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); else { free(parser->ret_stack); parser->ret_stack = NULL; @@ -422,7 +422,7 @@ parser->last_body = body; parser->ret_stack_size++; - parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); + parser->ret_stack = realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); if(parser->ret_stack_size > 1) memmove(parser->ret_stack+1,parser->ret_stack,(parser->ret_stack_size-1)*sizeof(ASX_LineSave_t)); parser->ret_stack[0].buffer = ret;