From patchwork Tue Sep 22 12:17:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Sionneau X-Patchwork-Id: 1369036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=uclibc-ng.org (client-ip=89.238.66.15; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=kalray.eu Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kalray.eu header.i=@kalray.eu header.a=rsa-sha256 header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b=COlJt17u; dkim-atps=neutral Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BwgLM4RMjz9sTH for ; Tue, 22 Sep 2020 22:17:47 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 25E1E1034D; Tue, 22 Sep 2020 14:17:25 +0200 (CEST) X-Original-To: devel@uclibc-ng.org Delivered-To: devel@helium.openadk.org Received: from mib.mailinblack.com (mib.mailinblack.com [185.7.73.95]) by helium.openadk.org (Postfix) with ESMTPS id 99ED210164 for ; Tue, 22 Sep 2020 14:17:18 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mib.mailinblack.com (Postfix) with ESMTP id 3F19A328D53 for ; Tue, 22 Sep 2020 12:17:18 +0000 (UTC) Received: from mib.mailinblack.com (localhost [127.0.0.1]) by mib.mailinblack.com with SMTP (Mib Daemon ) id KFDXBFN9 for devel@uclibc-ng.org; Tue, 22 Sep 2020 12:17:18 +0000 (UTC) Received: from zimbra2.kalray.eu (zimbra2.kalray.eu [92.103.151.219]) by mib.mailinblack.com (Postfix) with ESMTPS id 01A02328DF7 for ; Tue, 22 Sep 2020 12:17:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id BFB1A27E1067 for ; Tue, 22 Sep 2020 14:17:17 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id SgcxluLZJIVF; Tue, 22 Sep 2020 14:17:17 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 22D6927E102A; Tue, 22 Sep 2020 14:17:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 22D6927E102A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1600777037; bh=hcOTcHtXI9LsLhZ9o1m1Cptn9ovOSMDT5VX2MUaRyc8=; h=From:To:Date:Message-Id; b=COlJt17uhrQzxb4YLRDCKOqb4aJ9aOF2uLfLLmrhd7RBzj5a0YVwZuSOOPLVb989z FpPS92X7EU/IQR3nZIABbI8AVy47EwAQ/GEOUvNJtvNGY+STUiGU/qH8r3+GW0r5qR RmwQYp/cS96C1f8nxUtLQm40jo8juQQo7Iqd3p/s= X-Virus-Scanned: amavisd-new at zimbra2.kalray.eu Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id X_gmNfFnYzfr; Tue, 22 Sep 2020 14:17:17 +0200 (CEST) Received: from junon.lin.mbt.kalray.eu (unknown [192.168.37.161]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 0607B27E1066; Tue, 22 Sep 2020 14:17:17 +0200 (CEST) From: Yann Sionneau To: devel@uclibc-ng.org Date: Tue, 22 Sep 2020 14:17:01 +0200 Message-Id: <20200922121703.12838-5-ysionneau@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200922121703.12838-1-ysionneau@kalray.eu> References: <20200922121703.12838-1-ysionneau@kalray.eu> Subject: [uclibc-ng-devel] [PATCH 4/6] Fix warning due to unused variable in strlen X-BeenThere: devel@uclibc-ng.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: uClibc-ng Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: devel-bounces@uclibc-ng.org Sender: "devel" Fixes this: libc/string/generic/strlen.c: In function 'strlen': libc/string/generic/strlen.c:31:31: warning: variable 'magic_bits' set but not used [-Wunused-but-set-variable] unsigned long int longword, magic_bits, himagic, lomagic; ^~~~~~~~~~ Signed-off-by: Yann Sionneau --- libc/string/generic/strlen.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/libc/string/generic/strlen.c b/libc/string/generic/strlen.c index dc383398b..dcc032ddc 100644 --- a/libc/string/generic/strlen.c +++ b/libc/string/generic/strlen.c @@ -28,7 +28,7 @@ size_t strlen (const char *str) { const char *char_ptr; const unsigned long int *longword_ptr; - unsigned long int longword, magic_bits, himagic, lomagic; + unsigned long int longword, himagic, lomagic; /* Handle the first few characters by reading one character at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ @@ -52,14 +52,12 @@ size_t strlen (const char *str) The 1-bits make sure that carries propagate to the next 0-bit. The 0-bits provide holes for carries to fall into. */ - magic_bits = 0x7efefeffL; himagic = 0x80808080L; lomagic = 0x01010101L; if (sizeof (longword) > 4) { /* 64-bit version of the magic. */ /* Do the shift in two steps to avoid a warning if long has 32 bits. */ - magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; himagic = ((himagic << 16) << 16) | himagic; lomagic = ((lomagic << 16) << 16) | lomagic; } @@ -102,22 +100,7 @@ size_t strlen (const char *str) longword = *longword_ptr++; - if ( -#if 0 - /* Add MAGIC_BITS to LONGWORD. */ - (((longword + magic_bits) - - /* Set those bits that were unchanged by the addition. */ - ^ ~longword) - - /* Look at only the hole bits. If any of the hole bits - are unchanged, most likely one of the bytes was a - zero. */ - & ~magic_bits) -#else - ((longword - lomagic) & himagic) -#endif - != 0) + if (((longword - lomagic) & himagic) != 0) { /* Which of the bytes was the zero? If none of them were, it was a misfire; continue the search. */