From 2f5b8f05299731e1187475ff4bd6b1618bac3a1a Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 9 Dec 2015 00:38:32 +0000 Subject: * *.c (*_memsize): do not check ptr. NULL checking is finished Before call of memsize functions. See r52979. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'vm.c') diff --git a/vm.c b/vm.c index 4bae830633..23be295fef 100644 --- a/vm.c +++ b/vm.c @@ -2047,20 +2047,15 @@ ruby_vm_destruct(rb_vm_t *vm) static size_t vm_memsize(const void *ptr) { - if (ptr) { - const rb_vm_t *vmobj = ptr; - size_t size = sizeof(rb_vm_t); + const rb_vm_t *vmobj = ptr; + size_t size = sizeof(rb_vm_t); - size += vmobj->living_thread_num * sizeof(rb_thread_t); + size += vmobj->living_thread_num * sizeof(rb_thread_t); - if (vmobj->defined_strings) { - size += DEFINED_EXPR * sizeof(VALUE); - } - return size; - } - else { - return 0; + if (vmobj->defined_strings) { + size += DEFINED_EXPR * sizeof(VALUE); } + return size; } static const rb_data_type_t vm_data_type = { @@ -2298,21 +2293,16 @@ thread_free(void *ptr) static size_t thread_memsize(const void *ptr) { - if (ptr) { - const rb_thread_t *th = ptr; - size_t size = sizeof(rb_thread_t); + const rb_thread_t *th = ptr; + size_t size = sizeof(rb_thread_t); - if (!th->root_fiber) { - size += th->stack_size * sizeof(VALUE); - } - if (th->local_storage) { - size += st_memsize(th->local_storage); - } - return size; + if (!th->root_fiber) { + size += th->stack_size * sizeof(VALUE); } - else { - return 0; + if (th->local_storage) { + size += st_memsize(th->local_storage); } + return size; } #define thread_data_type ruby_threadptr_data_type -- cgit v1.2.3