[PATCH] dri2: Initialize padding in DRI2GetBuffers reply

Daniel Stone daniel at fooishbar.org
Wed Mar 2 03:56:33 PST 2011


On Wed, Mar 02, 2011 at 01:41:25PM +0200, Pauli Nieminen wrote:
> On 02/03/11 11:37 +0000, ext Daniel Stone wrote:
> > On Wed, Feb 23, 2011 at 07:01:04PM +0200, Pauli wrote:
> > > diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
> > > index 4e48e65..725823e 100644
> > > --- a/hw/xfree86/dri2/dri2ext.c
> > > +++ b/hw/xfree86/dri2/dri2ext.c
> > > @@ -227,11 +227,15 @@ send_buffers_reply(ClientPtr client, DrawablePtr pDrawable,
> > >      }
> > >  
> > >      rep.type = X_Reply;
> > > +    rep.pad1 = 0;
> > >      rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4;
> > >      rep.sequenceNumber = client->sequence;
> > >      rep.width = width;
> > >      rep.height = height;
> > >      rep.count = count - skip;
> > > +    rep.pad2 = 0;
> > > +    rep.pad3 = 0;
> > > +    rep.pad4 = 0;
> > >      WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep);
> > >  
> > >      for (i = 0; i < count; i++) {
> > 
> > Why not just memset(&rep, 0, sizeof(rep)) before you start filling it
> > in?
> 
> I tough using C99 named initializer but then I remembered opposition against
> using 11 years old standard features. But I guess memset would be option too.

memset is pretty much the standard way to do it, and is the most
future-proof, etc.

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110302/da84bab3/attachment.pgp>


More information about the xorg-devel mailing list