[MPlayer-dev-eng] Re: [PATCH] Development (Was: Clean up demuxers)

Alban Bedel albeu at free.fr
Wed Feb 27 17:20:36 CET 2002


Hi Falk Hueffner,

on 27 Feb 2002 16:46:34 +0100 you wrote:

> Arpi <arpi at thot.banki.hu> writes:
> 
> > >   if(! IS_RUNNING(config)) {
> > >     if(strcasecmp(opt,"vcd") == 0) {
> > >       char* s;
> > >       if(!param)
> > >         return ERR_MISSING_PARAM;
> > >       s = (char*)malloc((strlen(param) + 6 + 1)*sizeof(char));
> > >       sprintf(s,"vcd://%s",param);
> > >       entry = play_tree_new();
> > >       play_tree_add_file(entry,s);
> > >       free(s);
> > >     } else if(strcasecmp(opt,"dvd") == 0) {
> > > 
> > > is a punishable offense in a few countries. If you cannot accept cleanup
> > 
> > what's the problem with this? it is not my code, anyway it looks ok for me.
> 
> The multiplication with sizeof(char) is redundant. Since sizeof(char)
> is the base unit for sizeof(), it must always be 1 ;) (OK, actually, I
> also can't see the problem...)
> 
Afaik c standard only define minimum size so a char is AT LEAST one byte, but it can 
be bigger depending on the complier/platform. And I think sizeof(char) is a constant 
so the compiler will remove it if it's one. I know it's best to do in this way but as I'm 
sometime lazy there is someplace where (like most ppl) I assumed 
sizeof(char) == 1 :(
Not assuming the size of the type you use is anyway more portable imho.
	Albeu



More information about the MPlayer-dev-eng mailing list