Commit 02223d52 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

engine: better Bstrncpyz()

parent d6cce53b
......@@ -1201,8 +1201,12 @@ static FORCE_INLINE uint16_t system_15bit_rand(void) { return ((uint16_t)rand())
// Copy min(strlen(src)+1, n) characters into dst, always terminate with a NUL.
static FORCE_INLINE char *Bstrncpyz(char *dst, const char *src, bsize_t n)
{
Bstrncpy(dst, src, n);
dst[n-1] = 0;
if (n > 0)
{
Bmemcpy(dst, src, min(Bstrlen(src)+1, n-1));
dst[n-1] = '\0';
}
return dst;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment