[Xcb] about api changes

Christoph Pfister christophpfister at gmail.com
Fri Nov 9 10:34:13 PST 2007

Am Montag 05 November 2007 schrieb Jamey Sharp:
> Guess I'm a little late to the party... Sorry my response is long, but
> you folks said a lot. ;-)
> On Fri, Jun 08, 2007 at 06:26:38PM +0200, Christoph Pfister wrote:
> > This way it should be clear when to use *_next(...) and when not (you
> > can assume that whenever you do something else than dereferencing the
> > data pointer of a *iterator_t you're on the wrong path).
> You're always doing something wrong if you're manipulating the pointer
> in an iterator_t. If you want direct pointer manipulation, use the array
> form, not an iterator.

So you should use one of the following ways ... that's ok (oh well, a) doesn't 
work at one place because of a code generator bug - but that will be solved 
sometime :)

a) get a pointer to the first element + advance yourself
c) get an iterator + use the _next() function

<snip unrelated (to me) stuff>

> On Wed, Jun 13, 2007 at 01:16:54PM +0200, Christoph Pfister wrote:
> > Am Mittwoch, 13. Juni 2007 00:02 schrieb Thomas Hunger:
> > > The iterators could be used by extension protocols. ... A different
> > > example is the RECTANGLE iterator. It is not needed in xproto, but
> > > xfixes has a reply with a list of RECTANGLEs, so the iterator is
> > > needed.
> >
> > A possible problem with that (oh - currently I seem to detect them
> > all) is when you have one place where you have those elements stored
> > in continuous list and one place where you have a non-continuous list.
> > Right, the iterator structure itself isn't affected by that, but the
> > accessor functions are - so in theory you would need to name the
> > accessor functions not xcb_<it-name>_* but xcb_<context>_* - luckily
> > non-continuous lists aren't used much and this problem hasn't arised
> > (yet) ...
> I don't understand. A list of fixed-length elements is a list of
> fixed-length elements no matter what context it occurs in. Yes, finding
> the start of the list is context-dependent--that's why we have
> xcb_setup_roots_iterator, not a generic xcb_screen_iterator function,
> for example. But once you've found the start, you can always access it
> the same way, no matter how you got it.

We had a larger discussion where we concluded that I was wrong ;) - so this is 
a non-issue.

<snip unrelated stuff>

> Jamey


More information about the Xcb mailing list