[MPlayer-cvslog] r23248 - trunk/libmenu/menu.c

Benjamin Zores ben at geexbox.org
Mon May 7 19:07:31 CEST 2007


Ivo a écrit :
> Hi,
> 
> On Monday 07 May 2007 18:48, ben wrote:
>> Author: ben
>> Date: Mon May  7 18:48:55 2007
>> New Revision: 23248
>>
>> Log:
>> removed useless casts as pointed out by reimar
>>
>> Modified:
>>    trunk/libmenu/menu.c
>>
>> Modified: trunk/libmenu/menu.c
>> =========================================================================
>> ===== --- trunk/libmenu/menu.c	(original)
>> +++ trunk/libmenu/menu.c	Mon May  7 18:48:55 2007
>> @@ -354,14 +354,14 @@ static char *menu_fribidi(char *txt)
>>          char_set_num = fribidi_parse_charset("UTF-8");
>>        }
>>        buffer_size = 1024 > (len+1) ? 1024 : (len+1);
>> -      logical = (FriBidiChar*) malloc(buffer_size);
>> -      visual = (FriBidiChar*) malloc(buffer_size);
>> -      outputstr = (char*) malloc(buffer_size);
>> +      logical = malloc(buffer_size);
>> +      visual = malloc(buffer_size);
>> +      outputstr = malloc(buffer_size);
> 
> Perhaps it is useful to know you can detect most of this kind of code by 
> running:
> 
> $ cd libmenu
> $ ../TOOLS/checktree.sh -showcont -none -stupid menu.c
> 
> checking for stupid code ...
> --> casting of void* calloc()
> --> casting of void* malloc()
> 357:      logical = (FriBidiChar*) malloc(buffer_size);
> 358:      visual = (FriBidiChar*) malloc(buffer_size);
> 359:      outputstr = (char*) malloc(buffer_size);
> --> casting of void* realloc()
> 362:      logical = (FriBidiChar*) realloc(logical, buffer_size);
> 363:      visual = (FriBidiChar*) realloc(visual, buffer_size);
> 364:      outputstr = (char*) realloc(outputstr, buffer_size);
> [..snip..]

I wasn't aware of this tool but thx, it's great to know.

Ben



More information about the MPlayer-cvslog mailing list