On Tue, Nov 04, 2025 at 02:15:16PM +0100, Kevin Wolf wrote:
> Am 04.11.2025 um 12:03 hat Daniel P. Berrangé geschrieben:
> > On Mon, Nov 03, 2025 at 02:10:55PM -0600, Eric Blake wrote:
> > > The code had three similar repetitions of an iteration over one or all
> > > of nsiocs to set up a GSource, and likewise for teardown.  Since an
> > > upcoming patch wants to tweak whether GSource or AioContext is used,
> > > its better to consolidate that into one helper function for fewer
> > > places to edit later.
> > > 

> > > -    listener->nsioc++;
> > > +    qio_net_listener_watch(listener, listener->nsioc++, "add");
> > 
> > Nit-picking, I'd have a slight preference to keep the 'nsioc' increment
> > on the following line from the qio_net_listener_watch call, as I don't
> > like side effects in passing the function arguments.
> 
> It actually wouldn't work any more because qio_net_listener_watch()
> iterates up to listener->nsioc. It needs the increased value in
> listener->nsioc, and the previous one for i, so that we get exactly one
> loop iteration.

I'm happy to change it to this in v2, to avoid the side-effect in the
function call:

listener->nsioc++;
qio_net_listener_watch(listener, listener->nsioc - 1, "add");

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org


Reply via email to