Implement strnlen on OS X <= 10.6

Fixes #182
develop
lethosor 2015-08-24 17:51:39 -04:00
parent 001f9e79b0
commit 29a0aee44c
1 changed files with 10 additions and 0 deletions

@ -49,6 +49,16 @@ distribution.
using namespace DFHack;
using namespace DFHack::LuaWrapper;
#ifdef _DARWIN
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6
size_t strnlen (const char *str, size_t max)
{
const char *end = (const char*)memchr(str, 0, max);
return end ? (size_t)(end - str) : max;
}
#endif
#endif
/**************************************
* Identity object read/write methods *
**************************************/