mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
fix compile on osx and linux
added GetPluginDirectory (please check on windows) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2490 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -37,14 +37,24 @@ const char *GetLastErrorMsg()
|
||||
return errStr;
|
||||
}
|
||||
|
||||
char *strndup (char const *s, size_t n)
|
||||
#ifdef __APPLE__
|
||||
// strlen with cropping after size n
|
||||
size_t strnlen(const char *s, size_t n)
|
||||
{
|
||||
const char *p = (const char *)memchr(s, 0, n);
|
||||
return(p ? p-s : n);
|
||||
}
|
||||
#endif
|
||||
|
||||
// strdup with cropping after size n
|
||||
char* strndup(char const *s, size_t n)
|
||||
{
|
||||
size_t len = strnlen(s, n);
|
||||
char *dup = (char *)malloc(len + 1);
|
||||
|
||||
if (dup == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
dup[len] = '\0';
|
||||
return (char *)memcpy(dup, s, len);
|
||||
}
|
||||
|
Reference in New Issue
Block a user