xref: /freebsd/lib/libc/string/mempcpy.c (revision 0c47b9c211ede221629914ae0c5553586e772109)
1ee37f64cSKonstantin Belousov /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3ee37f64cSKonstantin Belousov  *
4ee37f64cSKonstantin Belousov  * Copyright (c) 2021 The FreeBSD Foundation
5ee37f64cSKonstantin Belousov  *
6ee37f64cSKonstantin Belousov  * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
7ee37f64cSKonstantin Belousov  * under sponsorship from the FreeBSD Foundation.
8ee37f64cSKonstantin Belousov  *
9ee37f64cSKonstantin Belousov  * Redistribution and use in source and binary forms, with or without
10ee37f64cSKonstantin Belousov  * modification, are permitted provided that the following conditions
11ee37f64cSKonstantin Belousov  * are met:
12ee37f64cSKonstantin Belousov  * 1. Redistributions of source code must retain the above copyright
13ee37f64cSKonstantin Belousov  *    notice, this list of conditions and the following disclaimer.
14ee37f64cSKonstantin Belousov  * 2. Redistributions in binary form must reproduce the above copyright
15ee37f64cSKonstantin Belousov  *    notice, this list of conditions and the following disclaimer in the
16ee37f64cSKonstantin Belousov  *    documentation and/or other materials provided with the distribution.
17ee37f64cSKonstantin Belousov  *
18ee37f64cSKonstantin Belousov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19ee37f64cSKonstantin Belousov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20ee37f64cSKonstantin Belousov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ee37f64cSKonstantin Belousov  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22ee37f64cSKonstantin Belousov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23ee37f64cSKonstantin Belousov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24ee37f64cSKonstantin Belousov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25ee37f64cSKonstantin Belousov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26ee37f64cSKonstantin Belousov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27ee37f64cSKonstantin Belousov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28ee37f64cSKonstantin Belousov  * SUCH DAMAGE.
29ee37f64cSKonstantin Belousov  */
30ee37f64cSKonstantin Belousov 
31ee37f64cSKonstantin Belousov #include <string.h>
32cf8e5289SKyle Evans #include <ssp/ssp.h>
33ee37f64cSKonstantin Belousov 
34ee37f64cSKonstantin Belousov void *
35*0c47b9c2SKyle Evans (mempcpy)(void *__restrict dst, const void *__restrict src,
36cf8e5289SKyle Evans     size_t len)
37ee37f64cSKonstantin Belousov {
38ee37f64cSKonstantin Belousov 	return ((char *)memcpy(dst, src, len) + len);
39ee37f64cSKonstantin Belousov }
40