[Xcb] Iter

Jeremy Kolb jkolb at brandeis.edu
Sat Dec 17 15:56:23 PST 2005


Jamey Sharp wrote:
> On Sat, Dec 17, 2005 at 02:28:10PM -0500, Jeremy Kolb wrote:
> 
>>As much as I enjoy iters a lot of xlib code was written using pointers
>>and then you could simply use array syntax. I've noticed that sometimes
>>XCB will generate a function that allows me to do this: it simply
>>returns a pointer to an array of some structure.  Then when I modify
>>that structure it decides to only make an Iter function.
>>
>>For instance:
>>
>>...
>>
>>And now I'm missing that first function and only get an Iter function.
>>This seems pretty inconsistent to me, and I would really like the
>>XCBXvQueryEncodingsInfo function both times.
>>
>>Is this a bug or is it because of the list inside the structure?
> 
> 
> It's because of the list inside the structure: at that point the
> structure is variable-length, and C-style arrays can't work.
> 
> Xlib gets around this by allocating a bunch of new arrays and copying
> the entire contents of the reply into the arrays. We didn't want to go
> there.
> 
> --Jamey
> 

Ah okay, I had a feeling that's what it was.  I feel like we should
either provide both or just use the iterators interface.  It's kind of
confusing.

Jeremy


More information about the Xcb mailing list