lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-07-01 21:40:11 -05:00
committed by Serge Hallyn
parent 22272347b6
commit 40ab806066
29 changed files with 88 additions and 95 deletions
-20
View File
@@ -1,20 +0,0 @@
/*
* SPDX-FileCopyrightText: 2022 - 2023, Alejandro Colomar <alx@kernel.org>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <config.h>
#if !defined(HAVE_STPECPY)
#ident "$Id$"
#include "string/stpecpy.h"
extern inline char *stpecpy(char *dst, char *end, const char *restrict src);
#endif // !HAVE_STPECPY
+12
View File
@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <config.h>
#include "string/strcpy/stpecpy.h"
#if !defined(HAVE_STPECPY)
extern inline char *stpecpy(char *dst, char *end, const char *restrict src);
#endif
@@ -1,18 +1,13 @@
/*
* SPDX-FileCopyrightText: 2022 - 2023, Alejandro Colomar <alx@kernel.org>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#ifndef SHADOW_INCLUDE_LIB_STPECPY_H_
#define SHADOW_INCLUDE_LIB_STPECPY_H_
#ifndef SHADOW_INCLUDE_LIB_STRING_STRCPY_STPECPY_H_
#define SHADOW_INCLUDE_LIB_STRING_STRCPY_STPECPY_H_
#include <config.h>
#if !defined(HAVE_STPECPY)
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
@@ -20,8 +15,10 @@
#include "attr.h"
#if !defined(HAVE_STPECPY)
ATTR_STRING(3)
inline char *stpecpy(char *dst, char *end, const char *restrict src);
#endif
/*
@@ -66,6 +63,7 @@ inline char *stpecpy(char *dst, char *end, const char *restrict src);
*/
#if !defined(HAVE_STPECPY)
inline char *
stpecpy(char *dst, char *end, const char *restrict src)
{
@@ -84,7 +82,7 @@ stpecpy(char *dst, char *end, const char *restrict src)
return stpcpy(mempcpy(dst, src, dlen), "") + trunc;
}
#endif
#endif // !HAVE_STPECPY
#endif // include guard
+7
View File
@@ -0,0 +1,7 @@
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <config.h>
#include "string/strcpy/strncpy.h"
+19
View File
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#ifndef SHADOW_INCLUDE_LIB_STRING_STRCPY_STRNCPY_H_
#define SHADOW_INCLUDE_LIB_STRING_STRCPY_STRNCPY_H_
#include <config.h>
#include <string.h>
#include "sizeof.h"
#define STRNCPY(dst, src) strncpy(dst, src, NITEMS(dst))
#endif // include guard
@@ -1,7 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023, Alejandro Colomar <alx@kernel.org>
* SPDX-License-Identifier: BSD-3-Clause
*/
// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <config.h>
@@ -9,9 +7,7 @@
#include <stddef.h>
#include <sys/types.h>
#ident "$Id$"
#include "string/strtcpy.h"
#include "string/strcpy/strtcpy.h"
extern inline ssize_t strtcpy(char *restrict dst, const char *restrict src,
@@ -1,11 +1,9 @@
/*
* SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
* SPDX-License-Identifier: BSD-3-Clause
*/
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#ifndef SHADOW_INCLUDE_LIB_STRTCPY_H_
#define SHADOW_INCLUDE_LIB_STRTCPY_H_
#ifndef SHADOW_INCLUDE_LIB_STRING_STRCPY_STRTCPY_H_
#define SHADOW_INCLUDE_LIB_STRING_STRCPY_STRTCPY_H_
#include <config.h>
@@ -16,7 +14,6 @@
#include <sys/types.h>
#include "attr.h"
#include "defines.h"
#include "sizeof.h"
@@ -4,4 +4,4 @@
#include <config.h>
#include "string/zustr2stp.h"
#include "string/strcpy/zustr2stp.h"
@@ -2,8 +2,8 @@
// SPDX-License-Identifier: BSD-3-Clause
#ifndef SHADOW_INCLUDE_LIB_STRING_ZUSTR2STP_H_
#define SHADOW_INCLUDE_LIB_STRING_ZUSTR2STP_H_
#ifndef SHADOW_INCLUDE_LIB_STRING_STRCPY_ZUSTR2STP_H_
#define SHADOW_INCLUDE_LIB_STRING_STRCPY_ZUSTR2STP_H_
#include <config.h>
-21
View File
@@ -1,21 +0,0 @@
/*
* SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef SHADOW_INCLUDE_LIB_STRNCPY_H_
#define SHADOW_INCLUDE_LIB_STRNCPY_H_
#include <config.h>
#include <string.h>
#include "sizeof.h"
#define STRNCPY(dst, src) strncpy(dst, src, NITEMS(dst))
#endif // include guard