On Fri, Sep 02, 2016 at 04:52:18PM -0400, Stefan Hajnoczi wrote:
> On Tue, Aug 09, 2016 at 04:31:33PM +0100, Daniel P. Berrange wrote:
> > +TraceEvent *trace_event_iter_next(TraceEventIter *iter)
> > +{
> > +    TraceEvent *ev;
> > +
> > +    if (iter->event >= TRACE_EVENT_COUNT) {
> > +        return NULL;
> > +    }
> > +
> > +    ev = &(trace_events[iter->event]);
> > +
> > +    do {
> > +        iter->event++;
> > +    } while (iter->event < TRACE_EVENT_COUNT &&
> > +             iter->pattern &&
> > +             !pattern_glob(iter->pattern,
> > +                           
> > trace_event_get_name(&(trace_events[iter->event]))));
> > +
> > +    return ev;
> > +}
> 
> Shouldn't ev be updated inside the while loop?  Otherwise the iterator
> always returns &trace_events[0] the first time it's called.

Sigh, yes, well spotted.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

Reply via email to