rm the unused calloc wrapper from memory_region
it doesn't actually call calloc, so it's fairly pointless
This commit is contained in:
parent
2e0614750c
commit
1a41b484bf
@ -121,8 +121,10 @@ memory_region::realloc(void *mem, size_t orig_size) {
|
||||
}
|
||||
|
||||
void *
|
||||
memory_region::malloc(size_t size, const char *tag, bool zero) {
|
||||
memory_region::malloc(size_t size, const char *tag) {
|
||||
# if RUSTRT_TRACK_ALLOCATIONS >= 1
|
||||
size_t old_size = size;
|
||||
# endif
|
||||
size += HEADER_SIZE;
|
||||
alloc_header *mem = (alloc_header *)::malloc(size);
|
||||
if (mem == NULL) {
|
||||
@ -143,18 +145,9 @@ memory_region::malloc(size_t size, const char *tag, bool zero) {
|
||||
void *data = get_data(mem);
|
||||
claim_alloc(data);
|
||||
|
||||
if(zero) {
|
||||
memset(data, 0, old_size);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void *
|
||||
memory_region::calloc(size_t size, const char *tag) {
|
||||
return malloc(size, tag, true);
|
||||
}
|
||||
|
||||
memory_region::~memory_region() {
|
||||
if (_synchronized) { _lock.lock(); }
|
||||
if (_live_allocations == 0 && !_detailed_leaks) {
|
||||
|
@ -77,8 +77,7 @@ private:
|
||||
public:
|
||||
memory_region(rust_env *env, bool synchronized);
|
||||
memory_region(memory_region *parent);
|
||||
void *malloc(size_t size, const char *tag, bool zero = true);
|
||||
void *calloc(size_t size, const char *tag);
|
||||
void *malloc(size_t size, const char *tag);
|
||||
void *realloc(void *mem, size_t size);
|
||||
void free(void *mem);
|
||||
~memory_region();
|
||||
|
@ -58,7 +58,7 @@ check_stack_canary(stk_seg *stk) {
|
||||
stk_seg *
|
||||
create_stack(memory_region *region, size_t sz) {
|
||||
size_t total_sz = sizeof(stk_seg) + sz;
|
||||
stk_seg *stk = (stk_seg *)region->malloc(total_sz, "stack", false);
|
||||
stk_seg *stk = (stk_seg *)region->malloc(total_sz, "stack");
|
||||
memset(stk, 0, sizeof(stk_seg));
|
||||
stk->end = (uintptr_t) &stk->data[sz];
|
||||
add_stack_canary(stk);
|
||||
|
@ -450,11 +450,6 @@ rust_task::backtrace() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
rust_task::calloc(size_t size, const char *tag) {
|
||||
return local_region.calloc(size, tag);
|
||||
}
|
||||
|
||||
size_t
|
||||
rust_task::get_next_stack_size(size_t min, size_t current, size_t requested) {
|
||||
LOG(this, mem, "calculating new stack size for 0x%" PRIxPTR, this);
|
||||
|
Loading…
Reference in New Issue
Block a user