(libretro-common) Add strldup to compat/strl

This commit is contained in:
twinaphex 2017-11-23 17:51:34 +01:00
parent 3c99ccbea5
commit 3bda00edaf
2 changed files with 9 additions and 0 deletions

View File

@ -60,3 +60,10 @@ size_t strlcat(char *dest, const char *source, size_t size)
return len + strlcpy(dest, source, size);
}
#endif
char *strldup(const char *s, size_t n)
{
char *dst = malloc(sizeof(char) * (n + 1));
strlcpy(dst, s, n);
return dst;
}

View File

@ -52,6 +52,8 @@ size_t strlcat(char *dest, const char *source, size_t size);
#endif
char *strldup(const char *s, size_t n);
RETRO_END_DECLS
#endif