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 --- compile.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 517b500996..6dcaf0814c 100644 --- a/compile.c +++ b/compile.c @@ -8054,16 +8054,11 @@ ibf_dump_free(void *ptr) static size_t ibf_dump_memsize(const void *ptr) { - if (ptr) { - struct ibf_dump *dump = (struct ibf_dump *)ptr; - size_t size = sizeof(*dump); - if (dump->iseq_table) size += st_memsize(dump->iseq_table); - if (dump->id_table) size += st_memsize(dump->id_table); - return size; - } - else { - return 0; - } + struct ibf_dump *dump = (struct ibf_dump *)ptr; + size_t size = sizeof(*dump); + if (dump->iseq_table) size += st_memsize(dump->iseq_table); + if (dump->id_table) size += st_memsize(dump->id_table); + return size; } static const rb_data_type_t ibf_dump_type = { @@ -8253,13 +8248,8 @@ ibf_loader_free(void *ptr) static size_t ibf_loader_memsize(const void *ptr) { - if (ptr) { - struct ibf_load *load = (struct ibf_load *)ptr; - return sizeof(struct ibf_load) + load->header->id_list_size * sizeof(ID); - } - else { - return 0; - } + struct ibf_load *load = (struct ibf_load *)ptr; + return sizeof(struct ibf_load) + load->header->id_list_size * sizeof(ID); } static const rb_data_type_t ibf_load_type = { -- cgit v1.2.3