diff options
Diffstat (limited to 'platform/linux-generic/include/odp_string_internal.h')
-rw-r--r-- | platform/linux-generic/include/odp_string_internal.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/platform/linux-generic/include/odp_string_internal.h b/platform/linux-generic/include/odp_string_internal.h new file mode 100644 index 000000000..37e9361af --- /dev/null +++ b/platform/linux-generic/include/odp_string_internal.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2022 Nokia + */ + +#ifndef ODP_STRING_INTERNAL_H_ +#define ODP_STRING_INTERNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stddef.h> + +/* Helps with snprintf() return value checking + * + * Otherwise like snprintf(), but returns always the number of characters + * printed (without the end mark) or zero on error. Terminates the string + * always with the end mark. */ +int _odp_snprint(char *str, size_t size, const char *format, ...); + +/* + * Copy a string + * + * Like strncpy(), but additionally ensures that the destination string is null + * terminated, unless sz is zero in which case returns dst without doing + * anything else. + */ +char *_odp_strcpy(char *restrict dst, const char *restrict src, size_t sz); + +#ifdef __cplusplus +} +#endif + +#endif |