Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp636285ybc; Sat, 23 Nov 2019 05:31:34 -0800 (PST) X-Google-Smtp-Source: APXvYqywJ9402FIt9RUnZ4FZU+2qmt34MX3tWpHoA5NP37NBAgIdHkB9dkbRueFFuKWFjbaG9e3e X-Received: by 2002:aa7:c894:: with SMTP id p20mr7383567eds.145.1574515894217; Sat, 23 Nov 2019 05:31:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574515894; cv=none; d=google.com; s=arc-20160816; b=VkWjklpkF6vScLQBkIXcsu+TIbrDvozjx+l1jpBPo7G0LONZpPijjMZmXSgFjo/HFA OaLun3sp26mjWxRZwQRBpvAHiVvHfFXRkaB41aAkEsstaZ5hwsSoSMbaA85kL7A5Rv1X LSTUn4JU/rxM5da1hnvCLaUI9zHK1pXAgvWjxEQtkYnU3YPp8IzQ+4BazItKkhOmrmI6 45wk9JIXoB0/GzS8GNbD+GpyjQVXMNq97Ddl/V4rUMmFlpyiDH7ldbPYgT9X0Ks3ZmQR fO75lpw5kM0zFifbEm/iN9y3F6M6M54dZvEZ8QZyLRTtv04mOfUkvXvNnjLynR7a/pdu JWQg== 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=YReDcxfG08+KN/ys3qrGQn3f4QFwxWEt7XHh/6OsNjk=; b=YH2FIwF8xHd9DSddCKiIqb09mMUDReScc8SdU2GA0+1zg5msbcOC5giCFz0w53PGkL UiIoZQ0XLu5q6D4YoSGB5DuanPm/NvhLJ9+nvEzgdBhaO/KkJy2F1qx84RPsroJSvc8D XE+0cUjedt4rc1J3gS7c9Cja+ju8ZOltVWh7BwRkK74W3RxQttaMu1RHcuVEQkqGchwv iNv01zXL0N3YifOvDnLUvvvNBJr31MSb9HqUJGlUWyTN6UbdOXpjYl6iUUi60ITBOCW8 lHZBfaCUAOse5SaU9WvqRoTQIULkcIwgc+ay5MROTm3iUuzNGeVARZIJkCvAxSEtPwCO VQFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=hiCg3yvw; 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 p24si1030487edt.411.2019.11.23.05.31.10; Sat, 23 Nov 2019 05:31:34 -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=hiCg3yvw; 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 S1727233AbfKWN2v (ORCPT + 99 others); Sat, 23 Nov 2019 08:28:51 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:39536 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbfKWN2A (ORCPT ); Sat, 23 Nov 2019 08:28:00 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-10.nifty.com with ESMTP id xANDRbkg000733; Sat, 23 Nov 2019 22:27:41 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com xANDRbkg000733 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574515662; bh=YReDcxfG08+KN/ys3qrGQn3f4QFwxWEt7XHh/6OsNjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hiCg3yvwtEG/PzPVSGTTU1RZvNrR30Q1AprIKE9IONc8dSnD4iIYhvVJKaj5F6ZiF /YThI0c9Vo12j5gg4J1+nnxnHq/AxZyU8ptViG4eQJKrCfSo6Vn9x4MVPndxNYT/u7 rCsjOiR+98C6dMaNDtFAcCxY8up1TwoY3ktDLGoHenMMreco65ClIQJqxnukZmlpdI LX2mF+33j4FicRkzKIL/dXcijupEkxsJrfdl1z7NyES+CVNYHPE7B/eN+sMVxJQsue 2/svM7js9DjmpU3VIV2WiJpT2zi+naJ6qS6o9OhMZ/a1qX4dY9u8/Rct657kkaMSff GykvGVGEB7KZA== 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 07/16] scripts/kallsyms: replace prefix_underscores_count() with strspn() Date: Sat, 23 Nov 2019 22:27:18 +0900 Message-Id: <20191123132727.30151-8-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123132727.30151-1-yamada.masahiro@socionext.com> References: <20191123132727.30151-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 with strspn(). I do not see noticeable performance difference. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 7b00b4030be4..a007d901c3a5 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -653,16 +653,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; @@ -691,8 +681,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; -- 2.17.1