Received: from eggs.gnu.org ([2001:4830:134:3::10]:48961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfvRo-0006zd-Gq for qemu-devel@nongnu.org; Fri, 02 Sep 2016 16:52:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfvRl-0005Jo-CR for qemu-devel@nongnu.org; Fri, 02 Sep 2016 16:52:24 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:32834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfvRl-0005Je-7V for qemu-devel@nongnu.org; Fri, 02 Sep 2016 16:52:21 -0400 Received: by mail-qk0-x244.google.com with SMTP id n66so8587835qkf.0 for ; Fri, 02 Sep 2016 13:52:21 -0700 (PDT) Date: Fri, 2 Sep 2016 16:52:18 -0400 From: Stefan Hajnoczi Message-ID: <20160902205218.GD21771@stefanha-x1.localdomain> References: <1470756748-18933-1-git-send-email-berrange@redhat.com> <1470756748-18933-6-git-send-email-berrange@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hxkXGo8AKqTJ+9QI" Content-Disposition: inline In-Reply-To: <1470756748-18933-6-git-send-email-berrange@redhat.com> Subject: Re: [Qemu-devel] [PATCH for-2.8 v1 05/60] trace: add trace event iterator APIs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org, Stefan Hajnoczi --hxkXGo8AKqTJ+9QI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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(). --hxkXGo8AKqTJ+9QI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJXyeaCAAoJEJykq7OBq3PIc3gH/1hdAByLEvZVfFRFn06Sln+s Z2YR86k44/ohbTK+4nH4tc2WGOU1zpnc7u6Boz3XSne4MF7xwZ6gDrmPaJj8XpHw 1TJ2g0jt+FiW53ZZkASGY3337OnZepk214Lbr4+1kVPbzoCzxm+yubVhjvo9MDtq 1jBsENfn+alsglEIKT2wFPOZyyCvkLasilpFFwCNFnorOyl3eU86q6g3o49nufER UN1K2c4xJeIcipWEfXuaFmy9B3Cao8SvIZciHA/TL29Nf90ex+iMyv5SXRJuTLny dDjDk1UmL6Fp4pPJC2mjThetAyEmEKU3t7DlKwBd/4+qq9yUps3y1foMmoIft+0= =AuJF -----END PGP SIGNATURE----- --hxkXGo8AKqTJ+9QI--