ruby-changes:40909
From: ko1 <ko1@a...>
Date: Wed, 9 Dec 2015 10:01:38 +0900 (JST)
Subject: [ruby-changes:40909] ko1:r52988 (trunk): * ext/**/*.c (*_memsize): same as r52986 for extensions.
ko1 2015-12-09 10:01:17 +0900 (Wed, 09 Dec 2015) New Revision: 52988 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52988 Log: * ext/**/*.c (*_memsize): same as r52986 for extensions. Modified files: trunk/ChangeLog trunk/ext/-test-/st/numhash/numhash.c trunk/ext/bigdecimal/bigdecimal.c trunk/ext/fiddle/closure.c trunk/ext/fiddle/function.c trunk/ext/fiddle/handle.c trunk/ext/fiddle/pointer.c trunk/ext/openssl/ossl_cipher.c trunk/ext/socket/ifaddr.c trunk/ext/socket/raddrinfo.c trunk/ext/stringio/stringio.c trunk/ext/strscan/strscan.c trunk/ext/win32ole/win32ole.c Index: ChangeLog =================================================================== --- ChangeLog (revision 52987) +++ ChangeLog (revision 52988) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Dec 9 09:58:09 2015 Koichi Sasada <ko1@a...> + + * ext/**/*.c (*_memsize): same as r52986 for extensions. + Wed Dec 9 09:46:19 2015 SHIBATA Hiroshi <hsbt@r...> * .gitignore: ignored ISeq binary format. Index: ext/bigdecimal/bigdecimal.c =================================================================== --- ext/bigdecimal/bigdecimal.c (revision 52987) +++ ext/bigdecimal/bigdecimal.c (revision 52988) @@ -172,7 +172,7 @@ static size_t https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L172 BigDecimal_memsize(const void *ptr) { const Real *pv = ptr; - return pv ? (sizeof(*pv) + pv->MaxPrec * sizeof(BDIGIT)) : 0; + return (sizeof(*pv) + pv->MaxPrec * sizeof(BDIGIT)); } static const rb_data_type_t BigDecimal_data_type = { Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 52987) +++ ext/win32ole/win32ole.c (revision 52988) @@ -3872,7 +3872,7 @@ static size_t https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3872 com_hash_size(const void *ptr) { const st_table *tbl = ptr; - return tbl ? st_memsize(tbl) : 0; + return st_memsize(tbl); } void Index: ext/-test-/st/numhash/numhash.c =================================================================== --- ext/-test-/st/numhash/numhash.c (revision 52987) +++ ext/-test-/st/numhash/numhash.c (revision 52988) @@ -10,7 +10,7 @@ numhash_free(void *ptr) https://github.com/ruby/ruby/blob/trunk/ext/-test-/st/numhash/numhash.c#L10 static size_t numhash_memsize(const void *ptr) { - return ptr ? st_memsize(ptr) : 0; + return st_memsize(ptr); } static const rb_data_type_t numhash_type = { Index: ext/openssl/ossl_cipher.c =================================================================== --- ext/openssl/ossl_cipher.c (revision 52987) +++ ext/openssl/ossl_cipher.c (revision 52988) @@ -91,7 +91,7 @@ static size_t https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_cipher.c#L91 ossl_cipher_memsize(const void *ptr) { const EVP_CIPHER_CTX *ctx = ptr; - return ctx ? sizeof(*ctx) : 0; + return sizeof(*ctx); } static VALUE Index: ext/fiddle/pointer.c =================================================================== --- ext/fiddle/pointer.c (revision 52987) +++ ext/fiddle/pointer.c (revision 52988) @@ -72,7 +72,7 @@ static size_t https://github.com/ruby/ruby/blob/trunk/ext/fiddle/pointer.c#L72 fiddle_ptr_memsize(const void *ptr) { const struct ptr_data *data = ptr; - return data ? sizeof(*data) + data->size : 0; + return sizeof(*data) + data->size; } static const rb_data_type_t fiddle_ptr_data_type = { Index: ext/fiddle/function.c =================================================================== --- ext/fiddle/function.c (revision 52987) +++ ext/fiddle/function.c (revision 52988) @@ -38,12 +38,11 @@ function_memsize(const void *p) https://github.com/ruby/ruby/blob/trunk/ext/fiddle/function.c#L38 /* const */ffi_cif *ptr = (ffi_cif *)p; size_t size = 0; - if (ptr) { - size += sizeof(*ptr); + size += sizeof(*ptr); #if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API - size += ffi_raw_size(ptr); + size += ffi_raw_size(ptr); #endif - } + return size; } Index: ext/fiddle/handle.c =================================================================== --- ext/fiddle/handle.c (revision 52987) +++ ext/fiddle/handle.c (revision 52988) @@ -46,7 +46,7 @@ fiddle_handle_free(void *ptr) https://github.com/ruby/ruby/blob/trunk/ext/fiddle/handle.c#L46 static size_t fiddle_handle_memsize(const void *ptr) { - return ptr ? sizeof(struct dl_handle) : 0; + return sizeof(struct dl_handle); } static const rb_data_type_t fiddle_handle_data_type = { Index: ext/fiddle/closure.c =================================================================== --- ext/fiddle/closure.c (revision 52987) +++ ext/fiddle/closure.c (revision 52988) @@ -41,14 +41,13 @@ closure_memsize(const void * ptr) https://github.com/ruby/ruby/blob/trunk/ext/fiddle/closure.c#L41 fiddle_closure * cls = (fiddle_closure *)ptr; size_t size = 0; - if (ptr) { - size += sizeof(*cls); + size += sizeof(*cls); #if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API - size += ffi_raw_size(&cls->cif); + size += ffi_raw_size(&cls->cif); #endif - size += sizeof(*cls->argv); - size += sizeof(ffi_closure); - } + size += sizeof(*cls->argv); + size += sizeof(ffi_closure); + return size; } Index: ext/socket/raddrinfo.c =================================================================== --- ext/socket/raddrinfo.c (revision 52987) +++ ext/socket/raddrinfo.c (revision 52988) @@ -725,7 +725,7 @@ addrinfo_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L725 static size_t addrinfo_memsize(const void *ptr) { - return ptr ? sizeof(rb_addrinfo_t) : 0; + return sizeof(rb_addrinfo_t); } static const rb_data_type_t addrinfo_type = { Index: ext/socket/ifaddr.c =================================================================== --- ext/socket/ifaddr.c (revision 52987) +++ ext/socket/ifaddr.c (revision 52988) @@ -62,8 +62,6 @@ ifaddr_memsize(const void *ptr) https://github.com/ruby/ruby/blob/trunk/ext/socket/ifaddr.c#L62 { const rb_ifaddr_t *ifaddr; const rb_ifaddr_root_t *root; - if (ptr == NULL) - return 0; ifaddr = ptr; root = get_root(ifaddr); return sizeof(rb_ifaddr_root_t) + (root->numifaddrs - 1) * sizeof(rb_ifaddr_t); Index: ext/stringio/stringio.c =================================================================== --- ext/stringio/stringio.c (revision 52987) +++ ext/stringio/stringio.c (revision 52988) @@ -67,7 +67,6 @@ static size_t https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L67 strio_memsize(const void *p) { const struct StringIO *ptr = p; - if (!ptr) return 0; return sizeof(struct StringIO); } Index: ext/strscan/strscan.c =================================================================== --- ext/strscan/strscan.c (revision 52987) +++ ext/strscan/strscan.c (revision 52988) @@ -181,11 +181,7 @@ static size_t https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L181 strscan_memsize(const void *ptr) { const struct strscanner *p = ptr; - size_t size = 0; - if (p) { - size = sizeof(*p) - sizeof(p->regs) + onig_region_memsize(&p->regs); - } - return size; + return sizeof(*p) - sizeof(p->regs) + onig_region_memsize(&p->regs); } static const rb_data_type_t strscanner_type = { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/