From nobody Mon Dec 25 14:25:49 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SzKvK657vz54nDn; Mon, 25 Dec 2023 14:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SzKvK3G45z3Mdd; Mon, 25 Dec 2023 14:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703514349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GlEqNwtPUZ0+/QErIYOGghZ1ryw0UTpwwZiwHGQCmV0=; b=M4RbupMpjj1sDAFt//8c2jZzBWpZuk1pGLmQGFtUkzA9xnSm2NLovv4ZFK34EA/J7F32Oj 3FvDfOCzH/0knm+xUV4RClDCv2UwXLBC5RHM41J5kTlBpKFOvFl06LnvjnfJwZZ3c1T477 QzTQyjUui/9iBZwNLIiZptKjkxFHswN54E07LGrqaIgW1giwkO/DlsbWgEHNXPebTUEB4d R75+Lo/PhNmNPBUvoUloa1CjIoAr+xZSMG9nLU+LZS3VxKjpgSMU4fFimflH9g2cl6X2A1 bhFTC8cgWwOS/PIgJao6Z3RzNTNb3T7Rf98M+gK2MVvioRKM37cyOPQyoplR+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703514349; a=rsa-sha256; cv=none; b=v24CG5RZPnx0J00CmR4nhlY8u72uKMQyEHg0qdgket7LyXB4KmW9svsV60znWXEx143a10 PNmaR0qk8GNdw+B4YNRS93b8OTIwwp8MokzW0x4UT3rrRh+xPu3STbQlWtmtJHqIdBDVbA ep4LTuqLvnP8AUfiLIT+jIUobfttdvlZsiofBlMfGzs8YcSywLDUPta7J5zSoiMr/kpjZB ATH+4uMHWHjD7iizrm+6I2ScAbj95BZ0EfDZNu+vauE0hjqujafodsx0/fScNx82+35at6 cpBM9fVxPoJthiqnhZoyJuP+oV1sqX0gc2LpppnNWYiV9fS1m1ptuiavcNYMzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703514349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GlEqNwtPUZ0+/QErIYOGghZ1ryw0UTpwwZiwHGQCmV0=; b=BYv/vpGhYwiDiIsNYax6RGU+0hY6A6qaWQJuBuK2CD/xFZnRpwlPFdFPZaTB/khVNZVqAQ yL2bZwS655uAbu4v0Urnu3FUPxJXlbRceiXNp3FcMeIHTcwCUgUas9agN2w2UCHkYkFSZk x3DJK0yjfANS2IMGHni2HnosikEoNAEiZK8y4KNKB5Wqfy2cbAmzYr3k7QEo4Uj4JXUlBq qf/ZrFFTaPSIDkJcA/YtrKctYGWc4LyHPrKMbFTlFQ2sSgQ/FDixXiv2abk+4bnRlfo04Z rn9UlLxkyTQNIE+TrSXXhfDqk5rOzH1tbS6C+wKxUGiEUcTvEar/hbtU3i1AaA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SzKvK1vzDzbd; Mon, 25 Dec 2023 14:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BPEPnXn023329; Mon, 25 Dec 2023 14:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BPEPnKm023326; Mon, 25 Dec 2023 14:25:49 GMT (envelope-from git) Date: Mon, 25 Dec 2023 14:25:49 GMT Message-Id: <202312251425.3BPEPnKm023326@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: e19d46c80826 - main - lib/libc/amd64/string: implement strncpy() by calling stpncpy() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e19d46c808267f53455e96a28ff7654211523d2c Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=e19d46c808267f53455e96a28ff7654211523d2c commit e19d46c808267f53455e96a28ff7654211523d2c Author: Robert Clausecker AuthorDate: 2023-11-09 04:25:55 +0000 Commit: Robert Clausecker CommitDate: 2023-12-25 13:55:48 +0000 lib/libc/amd64/string: implement strncpy() by calling stpncpy() Sponsored by: The FreeBSD Foundation Tested by: developers@, exp-run Approved by: mjg MFC after: 1 month MFC to: stable/14 PR: 275785 Differential Revision: https://reviews.freebsd.org/D42519 --- lib/libc/amd64/string/Makefile.inc | 1 + lib/libc/amd64/string/strncpy.c | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/lib/libc/amd64/string/Makefile.inc b/lib/libc/amd64/string/Makefile.inc index cc8b0e825e3e..d982061e080b 100644 --- a/lib/libc/amd64/string/Makefile.inc +++ b/lib/libc/amd64/string/Makefile.inc @@ -15,6 +15,7 @@ MDSRCS+= \ strcspn.S \ strlen.S \ strncmp.S \ + strncpy.c \ strnlen.c \ strpbrk.c \ strrchr.S \ diff --git a/lib/libc/amd64/string/strncpy.c b/lib/libc/amd64/string/strncpy.c new file mode 100644 index 000000000000..b3d868787fbe --- /dev/null +++ b/lib/libc/amd64/string/strncpy.c @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ''AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE + */ + +#include +#include + +char *__stpncpy(char *restrict, const char *restrict, size_t); + +char * +strncpy(char *restrict dst, const char *restrict src, size_t len) +{ + + __stpncpy(dst, src, len); + + return (dst); +}