From patchwork Sat Nov 23 13:27:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180099 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp736432ilf; Sat, 23 Nov 2019 05:28:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwjEjvdt6l8Ug3uQiPr4jKd4IAzmlbAqcWkdrITHN8WKf3I9aIdpafSCxLwF9/VmkGM3B7V X-Received: by 2002:a05:6402:1b04:: with SMTP id by4mr7192835edb.218.1574515737729; Sat, 23 Nov 2019 05:28:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574515737; cv=none; d=google.com; s=arc-20160816; b=LLPrsYTclrPZb5xKbqDgsFjRzswBx9valoVie0y5FzREJmajtueMdTpk3C7i4T7y20 orns/UX1QX/mTqFmdMdr3Beyro6yV1Y9tliuCpXiA4AiuDIIok84rIZsvllaD2lPAwBf q6WQJGWeIbnVi0iv7pkNAidRaMCtngCei7G4tOrWrw3cfDdtNp3nAlztWmL3VeTRfZAr EZ8RMO3QYxkcQWk7cYreK4bLvKzTb5D3SJKcu54dYvXFuXKtGfY1IkFDFqDvj8p41OgQ 9Y+l7NL18ICdWgKeZtvRju1DBHzhxApenE+HuwLzjWtDSbboKVKFkx/6df20VjgYGrt2 nbiQ== 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 d4si908283edk.445.2019.11.23.05.28.57; Sat, 23 Nov 2019 05:28:57 -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 S1727237AbfKWN2v (ORCPT + 26 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(-) -- 2.17.1 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;