Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp844484imu; Wed, 16 Jan 2019 08:28:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN4+lH3eyj/YW8Pl56XoexG/cUWsRKCJ2aDZRCcy9b1UofWb3uus3V3fNy74hDEmdaihrAoh X-Received: by 2002:a17:902:365:: with SMTP id 92mr10250371pld.327.1547656138630; Wed, 16 Jan 2019 08:28:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547656138; cv=none; d=google.com; s=arc-20160816; b=ljS4JVoOYMro3UG3I/RWaHIdkjiXFxc9agSeUoDIj7Hm95zXjrIGHP8gVK4SJohEen zGtIRCLTtDhHDi+ElnpqAfZD+zMCezAGGSWSe8Mm5iJSXv+tQGv21VEIq1YT5qGvgdzm GfVJZiwCcaDhgPcgMqOrE1tq/ZXNsE+UXefBvrConIwcOZtwN95orWcfPEtor3vvSb7A p6ohDaPvp/MuU7KPEz8yR3u39LG06QMEkVnW3tTJQdvAWNsj4LVFQ5UuGNJlUykwM5kE 7lmQ6J35W6SpEW3S8hXDO6O3bzPvT4BUrcNMPk24plcOZsHVpBMuUXjivokfT18W+PEm FzVQ== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=vngIkrq7MgOsnkDoerpwo9CcXG18jCLQhi0YS6yck28=; b=uRrWV5JwUllcjkiij4RSlZgsvCasXE+dXIiatAxoMxUBsrJ44Blz0b8H+Fta19zid5 Eyq9gbW+cxUQ8qvikH8jcHH3t3ou4Cqpzfmhopqogv3NW2Z19VFa77VsjmEKLTK0nPN9 VUsUQYpm2TWCPqTSQxS8SHDNPVjRJlSVLM9EGRXJccfsKiORQLXWBqi4eJxsYWEN18Ay ZT05qeSx0XVnXxsx7fvpQea7ndscVbM6IvY1eVWVV4tFRPsgNwC9gnPqL7z0IMlfKw6C AgjPWlTb7xI4qM/gAHECxYmMakjoPFahQb3WTPxFOqcnpQRA1f63D+HDD/6/RkSCqNnj 1OnA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si6669792pgg.290.2019.01.16.08.28.34; Wed, 16 Jan 2019 08:28:58 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732209AbfAPE7V (ORCPT + 99 others); Tue, 15 Jan 2019 23:59:21 -0500 Received: from smtprelay0192.hostedemail.com ([216.40.44.192]:60332 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728034AbfAPE7V (ORCPT ); Tue, 15 Jan 2019 23:59:21 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id 1631718045A60; Wed, 16 Jan 2019 04:59:20 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:355:379:599:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2691:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3868:3871:3872:3874:4321:5007:10004:10400:10848:11026:11232:11658:11914:12043:12114:12740:12760:12895:13069:13311:13357:13439:14659:14721:21080:21627:30029:30054:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:36,LUA_SUMMARY:none X-HE-Tag: train58_6e54b26c3325c X-Filterd-Recvd-Size: 1964 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA; Wed, 16 Jan 2019 04:59:18 +0000 (UTC) Message-ID: <7c07519607d08c0afe448a03fb2010bce13cd77f.camel@perches.com> Subject: Re: [PATCH v12 01/16] tracing: Use str_has_prefix() in synth_event_create() From: Joe Perches To: Tom Zanussi , rostedt@goodmis.org Cc: tglx@linutronix.de, mhiramat@kernel.org, namhyung@kernel.org, vedang.patel@intel.com, bigeasy@linutronix.de, joel@joelfernandes.org, mathieu.desnoyers@efficios.com, julia@ni.com, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org Date: Tue, 15 Jan 2019 20:59:16 -0800 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-01-15 at 16:05 -0600, Tom Zanussi wrote: > Since we now have a str_has_prefix() that returns the length, we can > use that instead of explicitly calculating it. [] > diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c [] > @@ -1200,8 +1200,7 @@ static int synth_event_create(int argc, const char **argv) > > /* This interface accepts group name prefix */ > if (strchr(name, '/')) { > - len = sizeof(SYNTH_SYSTEM "/") - 1; > - if (strncmp(name, SYNTH_SYSTEM "/", len)) > + if ((len = str_has_prefix(name, SYNTH_SYSTEM "/")) == 0) Since this is a single test, and not multiple if/else if blocks, I believe this would read better on two lines len = str_has_prefix(name, SYNTH_SYSTEM "/"); if (len == 0) > return -EINVAL; > name += len; > }