From 7c6e35995441fa8832f951b1fd42fba9f8d385d4 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Wed, 31 Mar 2021 18:54:48 -0700 Subject: [PATCH] globa: Export snd_strlcpy() Export snd_strlcpy() for use in the Topology2.0 pre-processor in alsatplg. Signed-off-by: Ranjani Sridharan --- include/global.h | 13 +++++++++++++ include/local.h | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/global.h b/include/global.h index 71a1b12f..89367004 100644 --- a/include/global.h +++ b/include/global.h @@ -153,6 +153,19 @@ typedef struct timeval snd_timestamp_t; /** Hi-res timestamp */ typedef struct timespec snd_htimestamp_t; +/** + * \brief Copy a C-string into a sized buffer + * \param dst Where to copy the string to + * \param src Where to copy the string from + * \param size Size of destination buffer + * \retval The source string length + * + * The result is always a valid NUL-terminated string that fits + * in the buffer (unless, of course, the buffer size is zero). + * It does not pad out the result like strncpy() does. + */ +size_t snd_strlcpy(char *dst, const char *src, size_t size); + /** \} */ #ifdef __cplusplus diff --git a/include/local.h b/include/local.h index ed6ba936..9d9deeac 100644 --- a/include/local.h +++ b/include/local.h @@ -236,7 +236,6 @@ int safe_strtol(const char *str, long *val); int snd_send_fd(int sock, void *data, size_t len, int fd); int snd_receive_fd(int sock, void *data, size_t len, int *fd); -size_t snd_strlcpy(char *dst, const char *src, size_t size); /* * error messages