[Xcb] Re: very first attempt of the keybinding
Jamey Sharp
jamey at minilop.net
Fri May 6 01:19:24 PDT 2005
On Fri, 2005-05-06 at 00:57 -0700, Josh Triplett wrote:
> Vincent Torri wrote:
> > One question, though:
> >
> > in atoms.c, there's following code in InternAtomFast:
> >
> > InternAtomFastCookie cookie;
> >
> > if((cookie.u.atom = InternAtomPredefined(name_len, name)).xid !=
> > None)
> > {
> > cookie.tag = TAG_VALUE;
> > return cookie;
> > }
> >
> > I don't understand why you check cookie.u.atom, as you've just declared
> > cookie. Its values should be random, shouldn't they ?
>
> Ah, the joys of C. :) cookie.u.atom is first being assigned the result
> of calling InternAtomPredefined, and then the xid member of that result
> is checked against None with the != operator.
Yeah, uh, you don't think the style I wrote that in was at all *unclear*
or anything, do you?
'Cause, you know, it totally is.
Oh well. :-)
Vincent, I'll echo what Josh said with equivalent code:
InternAtomFastCookie cookie;
cookie.u.atom = InternAtomPredefined(name_len, name);
if(cookie.u.atom.xid != None)
{
cookie.tag = TAG_VALUE;
return cookie;
}
If you wanted to commit that edit to CVS, I wouldn't be at all
opposed. :-)
--Jamey
More information about the xcb
mailing list