[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-xorg-devel
Subject: Re: [PATCH:libX11 2/2] Convert XCreate{Pix, Bit}map...Data to use C99 designated initializers
From: Alan Coopersmith <alan.coopersmith () oracle ! com>
Date: 2012-06-30 16:36:18
Message-ID: 4FEF2B02.7080600 () oracle ! com
[Download RAW message or body]
On 06/30/12 09:27 AM, walter harms wrote:
>
>
> Am 30.06.2012 17:04, schrieb Alan Coopersmith:
>> On 06/30/12 02:38 AM, walter harms wrote:
>>>> - pix = XCreatePixmap(display, d, width, height, 1);
>>>> - gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0);
>>>> + Pixmap pix = XCreatePixmap(display, d, width, height, 1);
>>>
>>> if you assume that gc can fail you should check pix also
>>> if ( pix == NULL )
>>> return (Pixmap) None;
>>
>> Nope - Xlib doesn't do the same things there, since in Xlib, a GC
>> is a pointer to a struct, while a Pixmap is simply an XID (integer).
>>
>> XCreateGC can return NULL if malloc fails:
>> http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/CrGC.c#n64
>>
>> XCreatePixamp doesn't malloc, simply returns the next available XID:
>> http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/CrPixmap.c#n40
>>
> yep,
> XAllocID(dpy) is the core but can it never fail ?
Not that I'm aware of.
> according to the man page:
> "XCreatePixmap can generate BadAlloc, BadDrawable, and BadValue errors."
Those are asynchronous X11 protocol errors that can be generated when the
X server gets around to processing the request that XCreatePixmap puts in
the buffer - they aren't returned directly from XCreatePixmap itself.
--
-Alan Coopersmith- alan.coopersmith@oracle.com
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic