[MPlayer-cvslog] r32906 - trunk/gui/skin/font.c

Ingo Brückl ib at wupperonline.de
Wed Feb 16 18:56:52 CET 2011

Clément Boesch wrote on Wed, 16 Feb 2011 17:55:07 +0100:

> Mmmh, I didn't look well to the gfree prototype: it should be:

>     gfree(void *p);

> with a cast into void ** in this function.

No, I disagree.

> It will avoid a lot of cast all over the code.

Yes, that's true, but it "lies" about the parameter and gives the compiler no
chance to warn me if I call gfree(p) instead of gfree(&p)! (And naming it
gfreep() won't help much as long as nobody can use the "p" in the function
name for checks. I, of course, could/should but tend to forget and make
mistakes and that's were the compiler assists with its warnings.)

Thinking about avoiding the cast, maybe a macro like

  #define nfree(p) { free(p); p = NULL; }

would be a suitable replacement for gfree()?


More information about the MPlayer-cvslog mailing list