On Thu, Aug 20, 2026 at 2:25 AM Stefan Hajnoczi <[email protected]> wrote:
>
> On Sat, Aug 15, 2026 at 01:48:16AM +0800, Zhang Chen wrote:
> > +static int iothread_holder_compare(const IOThreadHolder *holder_a,
> > +                                   const IOThreadHolder *holder_b)
> > +{
> > +    const char *name_a, *name_b;
> > +
> > +    if (holder_a->type != holder_b->type) {
> > +        return holder_b->type - holder_a->type;
>
> This isn't a bug, but compare functions return negative for a < b, 0 for
> equals, and positive for a > b. That's how the strcmp() below behaves.
> Here holder_b->type - holder_a->type reverses the order. Luckily I don't
> think anything relies on ordering, so it doesn't really matter, but it's
> inconsistent and a little confusing.
>
> I suggest holder_a->type - holder_b->type instead.

OK, will fix in the next version.

Thanks

Chen

Reply via email to