Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp478407ybf; Fri, 28 Feb 2020 01:37:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxgWQWvlSVveguwH11vsC1WnI/EVnAOnW1wt9xpqB+BwqMTox+aEkIkdPh1GQjkOxESIbNi X-Received: by 2002:aca:f242:: with SMTP id q63mr2492696oih.72.1582882672471; Fri, 28 Feb 2020 01:37:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582882672; cv=none; d=google.com; s=arc-20160816; b=0RLMuko7MFiEyfYUrBZH/CU8dMidx9jAtaFM/hnAo+FJp1hK9S1eRB1f7Da/TnIS8g oIm1cYFoyQgbXE8onJxujf+anaDq7piRsttjUhgQ4n1OmtjS7AbuFIVrN2kS7xI1AdYx zQhUy2ReIO+It4swdf5Jg0gObRfRdQmZW08iDmWiqvapHFvib7UI7FXxIlbLSmSLfA6E /a2tZaRu9y3AMIwx4OVFogpYpnJmvu/OrjSxulz73OdX+1cqaPJWvB1UmaqQMZrXmcZf Zz4ZOPC6+Hb0Aa89FBRfN6+5QV8db74/IdhVx79Z/0UrxntNC0uDDDsT0yl85OGqOKvj 98NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=BCptEaS0Ov9O+XedxKjIMzFEZdpS9K8zEc74G440D4Q=; b=w+QyuJFR4hDRnrms8yuLPxTVd8zuGkwr3CwEuXpcxvy417vBo+SBnuDHhjn+fo69gY HaJabVOurlOFyqrBJ7FVUy3mKdhfe03zXUnsJ3jy2xJ0QzaRQos3a/bBVt7VL28LECnX gdTJdg7yLXfSVFXlpvIuZmgRgM/Y9Plkpu98aD2gzptNncg5lf9hc0NRXgbCkwB05Skj FmhvFlqhJ+6w43PAO7F8RxkSbG4ZFybywJDjiEYXGQt5RIcF6tFMn8q/FZHrt9ROJiIl DL6VgaDS1kfFXPXrfN5jWvok4rSPQZQ+18HvYypuLirnCF90CzmFr8yM3CXCYwCBo9ZW F6/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21si1156206otr.235.2020.02.28.01.37.40; Fri, 28 Feb 2020 01:37:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbgB1Jgr convert rfc822-to-8bit (ORCPT + 99 others); Fri, 28 Feb 2020 04:36:47 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:22365 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726583AbgB1Jgq (ORCPT ); Fri, 28 Feb 2020 04:36:46 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-YD3St3gwPAGMcIYNgCxbsg-1; Fri, 28 Feb 2020 04:36:41 -0500 X-MC-Unique: YD3St3gwPAGMcIYNgCxbsg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD6D6100550E; Fri, 28 Feb 2020 09:36:39 +0000 (UTC) Received: from krava.redhat.com (unknown [10.36.118.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id D91798AC3F; Fri, 28 Feb 2020 09:36:36 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Ravi Bangoria , Andi Kleen , Kajol Jain , John Garry Subject: [PATCH 5/5] perf expr: Make expr__parse return -1 on error Date: Fri, 28 Feb 2020 10:36:16 +0100 Message-Id: <20200228093616.67125-6-jolsa@kernel.org> In-Reply-To: <20200228093616.67125-1-jolsa@kernel.org> References: <20200228093616.67125-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To match the error value of the expr__find_other function, so all exported expr functions return the same values: 0 on success, -1 on error. Signed-off-by: Jiri Olsa --- tools/perf/tests/expr.c | 4 ++-- tools/perf/util/expr.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c index 755d73c86c68..28313e59d6f6 100644 --- a/tools/perf/tests/expr.c +++ b/tools/perf/tests/expr.c @@ -45,11 +45,11 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) p = "FOO/0"; ret = expr__parse(&val, &ctx, p); - TEST_ASSERT_VAL("division by zero", ret == 1); + TEST_ASSERT_VAL("division by zero", ret == -1); p = "BAR/"; ret = expr__parse(&val, &ctx, p); - TEST_ASSERT_VAL("missing operand", ret == 1); + TEST_ASSERT_VAL("missing operand", ret == -1); TEST_ASSERT_VAL("find other", expr__find_other("FOO + BAR + BAZ + BOZO", "FOO", &other, &num_other) == 0); diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c index 45b25530db5b..fd192ddf93c1 100644 --- a/tools/perf/util/expr.c +++ b/tools/perf/util/expr.c @@ -54,7 +54,7 @@ __expr__parse(double *val, struct parse_ctx *ctx, const char *expr, int expr__parse(double *final_val, struct parse_ctx *ctx, const char *expr) { - return __expr__parse(final_val, ctx, expr, EXPR_PARSE); + return __expr__parse(final_val, ctx, expr, EXPR_PARSE) ? -1 : 0; } static bool -- 2.24.1