From b63759b175cf9ddd9735ca0d2f803fe62f69c3c3 Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 26 Feb 2010 15:01:37 +0000 Subject: 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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30744 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmenu/menu_filesel.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libmenu') diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c index e6978d7fc2..06f6089806 100644 --- a/libmenu/menu_filesel.c +++ b/libmenu/menu_filesel.c @@ -193,7 +193,7 @@ static char **get_extensions(menu_t *menu){ if(!fp) return NULL; - extensions = (char **) malloc(sizeof(*extensions)); + extensions = malloc(sizeof(*extensions)); *extensions = NULL; while(fgets(ext,sizeof(ext),fp)) { @@ -204,9 +204,9 @@ static char **get_extensions(menu_t *menu){ ext[s-1] = '\0'; s--; } - e = (char *) malloc(s+1); - extensions = (char **) realloc(extensions, ++n * sizeof(*extensions)); - extensions = (char **) realloc(extensions, ++n * sizeof(*extensions)); + e = malloc(s+1); + extensions = realloc(extensions, ++n * sizeof(*extensions)); + extensions = realloc(extensions, ++n * sizeof(*extensions)); strcpy (e, ext); for (l=extensions; *l; l++); *l++ = e; @@ -262,7 +262,7 @@ static int open_dir(menu_t* menu,char* args) { } } - namelist = (char **) malloc(sizeof(char *)); + namelist = malloc(sizeof(char *)); extensions = get_extensions(menu); n=0; @@ -290,7 +290,7 @@ static int open_dir(menu_t* menu,char* args) { continue; } if(n%20 == 0){ // Get some more mem - if((tp = (char **) realloc(namelist, (n+20) * sizeof (char *))) + if((tp = realloc(namelist, (n+20) * sizeof (char *))) == NULL) { mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReallocError, strerror(errno)); n--; @@ -299,7 +299,7 @@ static int open_dir(menu_t* menu,char* args) { namelist=tp; } - namelist[n] = (char *) malloc(strlen(dp->d_name) + 2); + namelist[n] = malloc(strlen(dp->d_name) + 2); if(namelist[n] == NULL){ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno)); n--; -- cgit v1.2.3