mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-08-26 01:04:48 +03:00
Merge branch 'dev' into dev-debug
This commit is contained in:
commit
7f7fbd54e9
3 changed files with 7 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue