From patchwork Sat Nov 23 16:04:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180101 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886032ilf; Sat, 23 Nov 2019 08:05:07 -0800 (PST) X-Google-Smtp-Source: APXvYqyd0BLRPdV9PMv6g1r0I8JocRi/ObEZ/pGdzWOVCot4DJCbeqHWPbzvXSXA9gTTiIVE9blU X-Received: by 2002:a05:6402:184e:: with SMTP id v14mr7804884edy.138.1574525107482; Sat, 23 Nov 2019 08:05:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525107; cv=none; d=google.com; s=arc-20160816; b=iZ6dgBCJlaHmwV5EJgE/dTt3YZkTVEkh+ZhXtTm2Jj1WT/Bz6XcprDmJ7VdVsFcVo+ KPO5nYnQNPM+5CCxZUzOVJpSQiRFweZvISJCR1Haqi4me+mMwVJIIJ6Ctb7JCB4W7bHu zFmEnOohTEvZv+68sL1wM9+c+vHtz3QcgPjw1waYb2usP0im7Equ7ypUOIQ1MO/fHiu+ BunWHjyh3WuV8x5XzIPVbdzzr3PUVpI3eTa7q695QRms7SfEayYoOv9ydIUpMQtqYCig c97OJanoBQjl7CHN9GoSKlu0apRlWWkgJ5QycsISSAEKgug1VOclNUNt45zA7MwMi6cS eaAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=5lggXg5IEg7tnVaBbwPVhFClDCwiRJJs4nnaP/eGSlc=; b=sYRxgxQ3TgDQ8neqWbM288jDSKvBhzZimhzrZ0xYCiMIyLA6DHSAFntVcm/9DeaBjF bYLWsrfrclKLswguKWEJ3Izde8BZR6H/mCW0T1sXQa78iH8gPlFpl+nqDPtni0xODwuY FlmFQ4lZZFC4ASuNyIc5tHwEwQpji2mIEoDjXOHUNcObErTimu7sukUXHncjWhAN6xRw aCLnIbcdF9hId5Sk946Au85U/IU0BquX9OcBOA2aObcK6MJCUS4YzIG/tqMj7CP4jfFZ RilbvHkVOx50N5A2L3emD14RqQT9+wlyjEy/VdOclWUmDcCs3TgDIYii0mnLXJVDMKOe 0joA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=VwmXuzPh; 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 j1si1068885eds.39.2019.11.23.08.05.06; Sat, 23 Nov 2019 08:05:07 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=VwmXuzPh; 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 S1726990AbfKWQFD (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:03 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49445 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726705AbfKWQFB (ORCPT ); Sat, 23 Nov 2019 11:05:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5P019106; Sun, 24 Nov 2019 01:04:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5P019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525091; bh=5lggXg5IEg7tnVaBbwPVhFClDCwiRJJs4nnaP/eGSlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VwmXuzPhD1uessmiV+Ruu8F6Y+D7MZ687YsdNBGIvHKg70mg4Cx3SfLSORXOhsTJv Xt6pGQ9lYlHZ0xdSJx03kM/pNj/PFozWAbmMrXm9S+lnwRAsDv4jHBoFj1YFjeCbto i/1MPAf1c4xLkNrE+HzM78xumNwG+c3Fo5UjVLZkTojpicyMZ5nZ9P/bGCknI05A6H qPkuQ6oNJTO0J6Q6kXy2/5IVMwM0Uai2H6LxNdL4D2WsQm6MdCgEqN4D3rV2uCRH3w N1MEH7SSDC7WI+BqjqZ7c49dYRM9Eevk3iPhm+V28EWvBQjbIVzBTEo0FcMOsHntDI dUS9rNz6/YCdw== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 08/16] scripts/kallsyms: replace prefix_underscores_count() with strspn() Date: Sun, 24 Nov 2019 01:04:36 +0900 Message-Id: <20191123160444.11251-9-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org You can do equivalent things with strspn(). I do not see noticeable performance difference. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index baa2fa5692b0..89cc7c098c51 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -661,16 +661,6 @@ static int may_be_linker_script_provide_symbol(const struct sym_entry *se) return 0; } -static int prefix_underscores_count(const char *str) -{ - const char *tail = str; - - while (*tail == '_') - tail++; - - return tail - str; -} - static int compare_symbols(const void *a, const void *b) { const struct sym_entry *sa; @@ -699,8 +689,8 @@ static int compare_symbols(const void *a, const void *b) return wa - wb; /* sort by the number of prefix underscores */ - wa = prefix_underscores_count(sym_name(sa)); - wb = prefix_underscores_count(sym_name(sb)); + wa = strspn(sym_name(sa), "_"); + wb = strspn(sym_name(sb), "_"); if (wa != wb) return wa - wb;