From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932464AbdBHLbS (ORCPT ); Wed, 8 Feb 2017 06:31:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42344 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754090AbdBHLbR (ORCPT ); Wed, 8 Feb 2017 06:31:17 -0500 Date: Wed, 8 Feb 2017 12:31:15 +0100 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH 08/10] perf, tools: Add a simple expression parser for JSON Message-ID: <20170208113115.GB10639@krava> References: <20170128020345.19007-1-andi@firstfloor.org> <20170128020345.19007-9-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170128020345.19007-9-andi@firstfloor.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 08 Feb 2017 11:31:18 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 27, 2017 at 06:03:43PM -0800, Andi Kleen wrote: SNIP > diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h > new file mode 100644 > index 000000000000..3b99fa282059 > --- /dev/null > +++ b/tools/perf/util/expr.h > @@ -0,0 +1,23 @@ > +#ifndef PARSE_CTX_H > +#define PARSE_CTX_H 1 > + > +#define MAX_PARSE_ID 2 > + > +struct parse_id { > + const char *name; > + double val; > +}; > + > +struct parse_ctx { > + int num_ids; > + struct parse_id ids[MAX_PARSE_ID]; > +}; > + > +void expr_ctx_init(struct parse_ctx *ctx); > +void expr_add_id(struct parse_ctx *ctx, const char *id, double val); > +#ifndef IN_EXPR_Y > +int expr_parse(double *final_val, struct parse_ctx *ctx, const char **pp); > +#endif > +int expr_find_other(const char *p, const char *one, const char **other); it all looks ok, just please follow the interface function name style we try to keep with struct name separated with __ thanks, jirka