diff options
Diffstat (limited to 'include/c/str/cpy/stp/ustp/zustr2ustp.h')
-rw-r--r-- | include/c/str/cpy/stp/ustp/zustr2ustp.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/c/str/cpy/stp/ustp/zustr2ustp.h b/include/c/str/cpy/stp/ustp/zustr2ustp.h new file mode 100644 index 0000000..28aefd8 --- /dev/null +++ b/include/c/str/cpy/stp/ustp/zustr2ustp.h @@ -0,0 +1,29 @@ +// Copyright 2022 Alejandro Colomar <alx@kernel.org> +// SPDX-License-Identifier: LGPL-3.0-or-later WITH LGPL-3.0-linking-exception + + +#ifndef INCLUDE_C_STR_CPY_STP_USTP_ZUSTR2USTP_H_ +#define INCLUDE_C_STR_CPY_STP_USTP_ZUSTR2USTP_H_ + + +#include <stddef.h> +#include <string.h> + +#include <c/str/cpy/stp/_compiler.h> // IWYU pragma: keep +#include <c/str/cpy/stp/ustp/ustpcpy.h> + + +#pragma clang assume_nonnull begin +inline char *c_zustr2ustp(char *restrict dst, const char *restrict src, + size_t sz); + + +inline char * +c_zustr2ustp(char *restrict dst, const char *restrict src, size_t sz) +{ + return c_ustpcpy(dst, src, strnlen(src, sz)); +} +#pragma clang assume_nonnull end + + +#endif // Header guard |