[MPlayer-dev-eng] [PATCH] Direct3D libvo driver

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Nov 20 09:38:39 CET 2008


On Thu, Nov 20, 2008 at 10:26:35AM +0200, Georgi Petrov wrote:
> Ok, I'll fix the opening braces.
> 
> Don't worry - those are really cosmetic changes - no code was modified
> at all. I've tested everything myself and as far as the compiler
> cares, there's no difference. The only "changes" are in preinit:

I know, I took the effort to look through it.

>     /* Set to zero all global variables. */
>     priv = malloc(sizeof (struct global_priv));
>     if (!priv){
>         mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>Not enough memory\r\n");
>         return -1;
>     }
> 
>     memset(priv, 0, sizeof (struct global_priv));

There is also a mp_msg before that that is new which preferably should
not be in a (mostly) cosmetics patch.
Also please use calloc to get zeroed memory instead of malloc+memset.

> ...and in uninit:
> 
>     if (priv)
>         free (priv);

While I sometimes use such constructs for documentation purposes, it is
never necessary (free accepts NULL) and it gives the wrong impression
(there is not really any way prov should ever be NULL here).
Maybe setting priv = NULL afterwards just to be safe would be a good
idea though.

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list