From nobody Wed Jan 24 19:44:43 2024 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 4TKvYR3yK7z58bdc; Wed, 24 Jan 2024 19:44:43 +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 4TKvYR1h0Wz45Yv; Wed, 24 Jan 2024 19:44:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706125483; 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=4mwWIMsA8EW2p6ZJTe6rik4Nw5HAxOOWKM7iyAGNVZM=; b=umJZ808btVxoQ3CwWvD94u21YMBIiDXwPT8kBiWFoYzYQ2gBtfhIEHliLC2x2jGZxwVYHA AXyV14wNxroP3VfboIz0cTa0NSoE5MUpq4/gQOFF5SWStvW3JDi5ESCmmE+Qw5POkEG1p7 byfDwseUsKgnHTXGB4mdRZRKE0maMSw9IsrXiANtsoYRUtNEfpSH2Sa8oC/FLfQttinSA+ vunwOL+xh9vyheVppNgVBgThaQh3qhFzsWC/EClnpv1A/45cgPDGj5r62eZeejW+ni8e3X 7CSx+Q2exeiaPdRX8xA78btTMzscDAFjpoxoUzWLV+mZfyif1Qr3Zry9+U1rxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706125483; 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=4mwWIMsA8EW2p6ZJTe6rik4Nw5HAxOOWKM7iyAGNVZM=; b=YvxUJO/ITqpowus2V/P4xwxKnthxTKi5JzfzPhX7Z9wtmz8EqPmiJHvunhBKvDYl9pFIVA crT58i7q46P0CK1s5u/wqhH9OZbG84oQkqs5TVJ9olLMrAR+lqPndD3HwEjb9azX2b8Pe8 mGTvgA6NfkxGq4k0liYfgjGSgDCSyy4OCc+ewAzagBhS4L73nboAMnv9HRh9evtwVd19lG 1MDkm5LhMphZLPJp9ZsFLTCadpdxgTJ58EBa86MdRI8a0rmL3P9CT+09MRFR2M3UNzzosM 8iZSEV4hTU3xV7wH0+Y2WDm9E7cXW/p5YvuZB7M0SynbOALJtZdhE5tuRpZwNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706125483; a=rsa-sha256; cv=none; b=rCeHVIGtHrD0FC4TEwtE4GCbUUnrngWvnc4PllkkYAvSYuQzgbKDmK21BEhErIztj9YyAf 3hZpoMbO5j5tKq0TI8bLM3M5aTD2JZKbpUzmIs374Y+iEOE97G4btHtI0M/UrTo1SYx57O qKcmPVuNHUxy6otB+S/knQ84S9ERdrl5c8GUo4qsYfFduEyOSsyKlzrs4sTEP1fY2b8qbg paQjDCXVF2cb9PcLvSw/GHMHLw52Uwv+IzIo0MuchZCiyI/7WoRsJ0eB+ik5fcoRdD7oMZ QnvXqZbIa9keGqDWbu1vtAE+vmdXr0p+8Si7wz3gZfTRsMB0G9vEdwQWVA9VQg== 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 4TKvYR0kGyzS8v; Wed, 24 Jan 2024 19:44:43 +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 40OJihF5005423; Wed, 24 Jan 2024 19:44:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40OJihde005420; Wed, 24 Jan 2024 19:44:43 GMT (envelope-from git) Date: Wed, 24 Jan 2024 19:44:43 GMT Message-Id: <202401241944.40OJihde005420@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: 76f9afcdcfa4 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 76f9afcdcfa482d81d5f3017f29c087fe795bb4f Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=76f9afcdcfa482d81d5f3017f29c087fe795bb4f commit 76f9afcdcfa482d81d5f3017f29c087fe795bb4f Author: Robert Clausecker AuthorDate: 2023-11-09 04:25:55 +0000 Commit: Robert Clausecker CommitDate: 2024-01-24 19:39:27 +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 (cherry picked from commit e19d46c808267f53455e96a28ff7654211523d2c) --- 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); +}