From patchwork Tue Jan 17 20:00:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 63301 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AD49738983B0 for ; Tue, 17 Jan 2023 20:04:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD49738983B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673985896; bh=sY+YvZjWeG+Di1NMnZoY5q7yd+IP4Ia8ez9SoC+m9Hg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NwRnmLoaAd9E2917LvQAHisiU2MO4hoBmIO/tVp6C6Iii77va7QfEE7VM3eqqQSbB pxzwDLfkdy0sZD06bnJzkOtvnJpRAp88BfRzrt7E8tw5R0I18WJVsujyn+1fIz6+pP ZWFkigD1TQRvlvU1NXjxX31p9tEmgE53zMPVmZfQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 04AFD3858028 for ; Tue, 17 Jan 2023 20:00:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 04AFD3858028 Received: by mail-oi1-x232.google.com with SMTP id r205so26873395oib.9 for ; Tue, 17 Jan 2023 12:00:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sY+YvZjWeG+Di1NMnZoY5q7yd+IP4Ia8ez9SoC+m9Hg=; b=ginyQNlmwqGNvbcZ7TgjuVRfPS4k3ZO8q3J5Qx7fthuCLp7CCHwpYMmfqULw0jixNl LZIqz0wHHYci1zBctnrEl1iO0lzD7dLSnRWLF+no8LHEPv3xBfK7V8J/5PBb6b7SatRB RmwueBpfi555E44sA8w9EGNx2jMvpPzCxQ02ip4vP7SFCscUDKGFC/qkxnkKHo2rgvHO RLCKh63fXK4tqzMtUlFLkEmOxa5Ww3SKX+LIHx3vNcQnzjcjMqsXwYGHRNjeXbjJ5f4H a73dFBc2xhG6peZHXh2HxJBihroMkxrlyrXfvl4cEf0MfLbSLyMBRTqWehVeOpzw6wut yQPg== X-Gm-Message-State: AFqh2koA6qcew2vFqACfMx+7TG4j9hublxpm1t62a/CV8Qa7sva5tF5p ycDwREbzUIZuumJaMFDHJfwfIDPhfLySPjMieFM= X-Google-Smtp-Source: AMrXdXuvYl4HzjlcPlelYVwRjf5wIn7w06ZpCYqsdCuV66gMP9d+LBpGlOXZpbF+t5brECXsLEBMHw== X-Received: by 2002:a05:6808:614a:b0:35c:51c3:8cb1 with SMTP id dl10-20020a056808614a00b0035c51c38cb1mr1885641oib.13.1673985655918; Tue, 17 Jan 2023 12:00:55 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c1:1652:fbfc:c80a:f5e8:5ed9]) by smtp.gmail.com with ESMTPSA id l10-20020a056808020a00b00360e46a1edasm15095866oie.22.2023.01.17.12.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 12:00:55 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson , Noah Goldstein Subject: [PATCH v9 18/22] string: Hook up the default implementation on test-strnlen Date: Tue, 17 Jan 2023 17:00:10 -0300 Message-Id: <20230117200014.1299923-19-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230117200014.1299923-1-adhemerval.zanella@linaro.org> References: <20230117200014.1299923-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Also remove the SIMPLE_STRNLEN, which is not used anywhere. --- string/test-strnlen.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/string/test-strnlen.c b/string/test-strnlen.c index 8b5372c3a1..976c65dc09 100644 --- a/string/test-strnlen.c +++ b/string/test-strnlen.c @@ -43,17 +43,30 @@ typedef size_t (*proto_t) (const CHAR *, size_t); -IMPL (STRNLEN, 1) - -/* Naive implementation to verify results. */ -size_t -SIMPLE_STRNLEN (const CHAR *s, size_t maxlen) -{ - size_t i; - - for (i = 0; i < maxlen && s[i]; ++i); - return i; -} +/* Also check the default implementation. */ +#undef STRNLEN +#ifndef WIDE +# define MEMCHR __memchr_default +# define weak_alias(a, b) +# define libc_hidden_def(a) +# define libc_hidden_builtin_def(a) +# include "string/memchr.c" +# undef STRNLEN +# define STRNLEN __strlen_default +# define memchr __memchr_default +# include "string/strnlen.c" +IMPL (__strlen_default, 1) +#else +# define WMEMCHR __wmemchr_default +# define weak_alias(a, b) +# define libc_hidden_def(a) +# define libc_hidden_weak(a) +# include "wcsmbs/wmemchr.c" +# define WCSNLEN __wcsnlen_default +# define wmemchr __wmemchr_default +# include "wcsmbs/wcsnlen.c" +IMPL (__wcsnlen_default, 1) +#endif static void do_one_test (impl_t *impl, const CHAR *s, size_t maxlen, size_t exp_len)