diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-02-14 18:28:04 -0500 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-02-14 18:28:04 -0500 |
| commit | 1a41b484bf05514f469e69efd56fcd7039d34db9 (patch) | |
| tree | 7919895f900eeab44123a9bac38b38bdcb591d3a | |
| parent | 2e0614750c398c9aac2f4064addb2fa95ba32282 (diff) | |
| download | rust-1a41b484bf05514f469e69efd56fcd7039d34db9.tar.gz rust-1a41b484bf05514f469e69efd56fcd7039d34db9.zip | |
rm the unused calloc wrapper from memory_region
it doesn't actually call calloc, so it's fairly pointless
| -rw-r--r-- | src/rt/memory_region.cpp | 13 | ||||
| -rw-r--r-- | src/rt/memory_region.h | 3 | ||||
| -rw-r--r-- | src/rt/rust_stack.cpp | 2 | ||||
| -rw-r--r-- | src/rt/rust_task.cpp | 5 |
4 files changed, 5 insertions, 18 deletions
diff --git a/src/rt/memory_region.cpp b/src/rt/memory_region.cpp index 6307730b0f4..6de9d5a1df4 100644 --- a/src/rt/memory_region.cpp +++ b/src/rt/memory_region.cpp @@ -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) { diff --git a/src/rt/memory_region.h b/src/rt/memory_region.h index 7a68a0f8af5..999a992eefa 100644 --- a/src/rt/memory_region.h +++ b/src/rt/memory_region.h @@ -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(); diff --git a/src/rt/rust_stack.cpp b/src/rt/rust_stack.cpp index 7a3d21989ee..64ca256ff46 100644 --- a/src/rt/rust_stack.cpp +++ b/src/rt/rust_stack.cpp @@ -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); diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index e51af464e48..63dc1c9833e 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -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); |
