mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-21 06:19:31 +03:00
netbsd reallocarr updates errno handling.
This commit is contained in:
parent
55ccc94707
commit
79c573c4d9
1 changed files with 7 additions and 2 deletions
|
@ -98,10 +98,15 @@ void* mi_reallocarray( void* p, size_t count, size_t size ) mi_attr_noexcept {
|
|||
|
||||
int mi_reallocarr( void* p, size_t count, size_t size ) mi_attr_noexcept { // NetBSD
|
||||
mi_assert(p != NULL);
|
||||
if (p == NULL) return EINVAL; // should we set errno as well?
|
||||
if (p == NULL) {
|
||||
errno = EINVAL;
|
||||
return errno;
|
||||
}
|
||||
int s_errno = errno;
|
||||
void** op = (void**)p;
|
||||
void* newp = mi_reallocarray(*op, count, size);
|
||||
if (mi_unlikely(newp == NULL)) return errno;
|
||||
if (mi_unlikely(newp == NULL)) { return errno; }
|
||||
errno = s_errno;
|
||||
*op = newp;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue