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.

A doc comment would help clarify the intended semantics of
trace_event_iter_next().

Attachment: signature.asc
Description: PGP signature

Reply via email to