[PATCH] xf86-video-mga: replace deprecated X*alloc functions

Nicolas Kaiser nikai at nikai.net
Mon Apr 4 15:24:32 PDT 2011


* Ian Romanick <idr at freedesktop.org>:
> On 04/02/2011 11:17 AM, Nicolas Kaiser wrote:
> > diff --git a/src/mga_dri.c b/src/mga_dri.c
> > index 2723dd8..8b1d751 100644
> > --- a/src/mga_dri.c
> > +++ b/src/mga_dri.c
> > @@ -92,24 +92,24 @@ static Bool MGAInitVisualConfigs( ScreenPtr pScreen )
> >     case 16:
> >        numConfigs = 8;
> >  
> > -      pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig),
> > +      pConfigs = (__GLXvisualConfig*)calloc( 1, sizeof(__GLXvisualConfig) *
> >  						numConfigs );  
> 
> Why?  I think the correct thing is the switch numConfigs and sizeof(...)
> in all these cases.  Calling calloc like that is just silly.

That's the way I saw the wrapper do it in /usr/include/xorg/os.h:

#define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))

Sorry, I'll resend a fixed patch.

Best regards,
Nicolas Kaiser


More information about the xorg-devel mailing list