qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-2.8 v1 05/60] trace: add trace event iterato


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH for-2.8 v1 05/60] trace: add trace event iterator APIs
Date: Fri, 2 Sep 2016 16:52:18 -0400
User-agent: Mutt/1.7.0 (2016-08-17)

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

[Prev in Thread] Current Thread [Next in Thread]