ADd strlcpy when necessary.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2025-10-12 18:47:34 +02:00
parent c165ae4838
commit 200d59f91b
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -47,4 +47,23 @@
static void f(void)
#endif
#include <string.h>
#ifdef _MSC_VER
#ifndef HAVE_STRLCPY
static inline size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t srclen = strlen(src);
if (size != 0) {
size_t copylen = (srclen >= size) ? size - 1 : srclen;
memcpy(dst, src, copylen);
dst[copylen] = '\0';
}
return srclen;
}
#endif
#endif
#endif // _COMPAT_H