Merge branch 'dev' into dev-debug

This commit is contained in:
daan 2020-04-20 18:07:38 -07:00
commit 7f7fbd54e9
3 changed files with 7 additions and 4 deletions

View file

@ -696,7 +696,7 @@ MI_ALLOC_API2(mi_decl_restrict char*, strndup, mi_heap_t*, heap, const char*, s,
{
if (s == NULL) return NULL;
const char* end = (const char*)memchr(s, 0, n); // find end of string in the first `n` characters (returns NULL if not found)
const size_t m = (end != NULL ? (end - s) : n); // `m` is the minimum of `n` or the end-of-string
const size_t m = (end != NULL ? (size_t)(end - s) : n); // `m` is the minimum of `n` or the end-of-string
mi_assert_internal(m <= n);
char* t = (char*)MI_SOURCE_ARG(mi_heap_malloc, heap, m+1);
if (t == NULL) return NULL;