fix: Use memcpy() in minitar_strlcpy()

This allows the platform to provide a more optimized and FAST version of memcpy than
our manual implementation inside strlcpy.
This commit is contained in:
apio 2023-01-26 21:40:57 +01:00
parent 56250a226f
commit 4c90f9078b
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -45,7 +45,7 @@ static size_t minitar_strlcpy(char* dest, const char* src, size_t size)
len = full_len = strlen(src); len = full_len = strlen(src);
if (size == 0) return len; if (size == 0) return len;
if (len > (size - 1)) len = size - 1; if (len > (size - 1)) len = size - 1;
for (size_t i = 0; i < len; ++i) { *(dest + i) = *(src + i); } memcpy(dest, src, len);
dest[len] = 0; // null-terminate dest[len] = 0; // null-terminate
return full_len; return full_len;
} }