On Thu, 31 Aug 2023 at 16:00, Francisco Iglesias
<[email protected]> wrote:
>
> Hi Peter,
>
> On 2023-08-29 18:44, Peter Maydell wrote:
> > You don't need to g_tree_lookup() for every address. If
> > you use g_tree_lookup_node() you get a GTreeNode* back,
> > and you can then iterate through the tree from that point using
> > g_tree_node_next(), something like this:
> >
> >       for (node = g_tree_lookup_node(s->cframes, GUINT_TO_POINTER(addr));
> >            node && GPOINTER_TO_UINT(g_tree_node_key(node)) < end_addr;
> >            node = g_tree_node_next(node)) {
> >           XlnxCFrame *f = g_tree_node_value(node);  // definitely not NULL
> >           /* Transmit the data */
> >           for (int i = 0; i < FRAME_NUM_WORDS; i += 4) {
> >               ... etc ...
> >           }
> >       }
> >
>
> I tried above but it looks to require glib 2.68 so added a comment
> instead (didn't compile on my machine with glib-2.64 :/, if I understand
> meson.build correctly the min glib version supported is 2.56). Let me
> know if some other solution would be preferred.

Whoops, yes, I didn't notice the version-statement on
g_tree_lookup_node(). Yeah, keep what you have.

thanks
-- PMM

Reply via email to