prevector: Terminate without logging on failed allocation
Logging was introduced in aeb089ecc7
, but
this added a dependency on libbitcoin_util.a to libzcashconsensus.a.
This commit is contained in:
parent
aa1567f868
commit
60ad3752c8
|
@ -1,8 +1,6 @@
|
|||
#ifndef _BITCOIN_PREVECTOR_H_
|
||||
#define _BITCOIN_PREVECTOR_H_
|
||||
|
||||
#include <util.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
@ -173,11 +171,11 @@ private:
|
|||
success. These should instead use an allocator or new/delete so that handlers
|
||||
are called as necessary, but performance would be slightly degraded by doing so. */
|
||||
_union.indirect = static_cast<char*>(realloc(_union.indirect, ((size_t)sizeof(T)) * new_capacity));
|
||||
if (!_union.indirect) { new_handler_terminate(); }
|
||||
if (!_union.indirect) { std::terminate(); }
|
||||
_union.capacity = new_capacity;
|
||||
} else {
|
||||
char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
|
||||
if (!new_indirect) { new_handler_terminate(); }
|
||||
if (!new_indirect) { std::terminate(); }
|
||||
T* src = direct_ptr(0);
|
||||
T* dst = reinterpret_cast<T*>(new_indirect);
|
||||
memcpy(dst, src, size() * sizeof(T));
|
||||
|
|
Loading…
Reference in New Issue