diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-05-07 18:13:15 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-05-15 12:19:14 -0700 |
| commit | bfd9aa9755149725e39d8024d693ed76f92a30df (patch) | |
| tree | 45dff5217306f2f3c10ed1add0756f286acaf921 /src/rt/rust_exchange_alloc.cpp | |
| parent | 6a6076ae810d470dfb511712c303a4ee7ffedf00 (diff) | |
| download | rust-bfd9aa9755149725e39d8024d693ed76f92a30df.tar.gz rust-bfd9aa9755149725e39d8024d693ed76f92a30df.zip | |
core:rt: A few micro-opts
Diffstat (limited to 'src/rt/rust_exchange_alloc.cpp')
| -rw-r--r-- | src/rt/rust_exchange_alloc.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/rt/rust_exchange_alloc.cpp b/src/rt/rust_exchange_alloc.cpp index 5958c68f3e7..89257dc9f6e 100644 --- a/src/rt/rust_exchange_alloc.cpp +++ b/src/rt/rust_exchange_alloc.cpp @@ -15,14 +15,15 @@ #include <string.h> #include <stdio.h> -uintptr_t exchange_count = 0; +extern uintptr_t rust_exchange_count; +uintptr_t rust_exchange_count = 0; void * rust_exchange_alloc::malloc(size_t size) { void *value = ::malloc(size); assert(value); - sync::increment(exchange_count); + sync::increment(rust_exchange_count); return value; } @@ -36,20 +37,15 @@ rust_exchange_alloc::realloc(void *ptr, size_t size) { void rust_exchange_alloc::free(void *ptr) { - sync::decrement(exchange_count); + sync::decrement(rust_exchange_count); ::free(ptr); } -extern "C" uintptr_t * -rust_get_exchange_count_ptr() { - return &exchange_count; -} - void rust_check_exchange_count_on_exit() { - if (exchange_count != 0) { + if (rust_exchange_count != 0) { printf("exchange heap not empty on exit\n"); - printf("%d dangling allocations\n", (int)exchange_count); + printf("%d dangling allocations\n", (int)rust_exchange_count); abort(); } } |
