summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-09 00:38:32 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-09 00:38:32 +0000
commit2f5b8f05299731e1187475ff4bd6b1618bac3a1a (patch)
tree5f22302de3f437b1ba7e2e1d387d9665efda08fd /cont.c
parent6a15a37f0b8f03c98f4b47ec777efa1ae75d7526 (diff)
* *.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
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/cont.c b/cont.c
index ba72fd5..3278f67 100644
--- a/cont.c
+++ b/cont.c
@@ -280,26 +280,25 @@ cont_memsize(const void *ptr)
{
const rb_context_t *cont = ptr;
size_t size = 0;
- if (cont) {
- size = sizeof(*cont);
- if (cont->vm_stack) {
+
+ size = sizeof(*cont);
+ if (cont->vm_stack) {
#ifdef CAPTURE_JUST_VALID_VM_STACK
- size_t n = (cont->vm_stack_slen + cont->vm_stack_clen);
+ size_t n = (cont->vm_stack_slen + cont->vm_stack_clen);
#else
- size_t n = cont->saved_thread.stack_size;
+ size_t n = cont->saved_thread.stack_size;
#endif
- size += n * sizeof(*cont->vm_stack);
- }
+ size += n * sizeof(*cont->vm_stack);
+ }
- if (cont->machine.stack) {
- size += cont->machine.stack_size * sizeof(*cont->machine.stack);
- }
+ if (cont->machine.stack) {
+ size += cont->machine.stack_size * sizeof(*cont->machine.stack);
+ }
#ifdef __ia64
- if (cont->machine.register_stack) {
- size += cont->machine.register_stack_size * sizeof(*cont->machine.register_stack);
- }
-#endif
+ if (cont->machine.register_stack) {
+ size += cont->machine.register_stack_size * sizeof(*cont->machine.register_stack);
}
+#endif
return size;
}
@@ -343,14 +342,13 @@ fiber_memsize(const void *ptr)
{
const rb_fiber_t *fib = ptr;
size_t size = 0;
- if (ptr) {
- size = sizeof(*fib);
- if (fib->cont.type != ROOT_FIBER_CONTEXT &&
- fib->cont.saved_thread.local_storage != NULL) {
- size += st_memsize(fib->cont.saved_thread.local_storage);
- }
- size += cont_memsize(&fib->cont);
+
+ size = sizeof(*fib);
+ if (fib->cont.type != ROOT_FIBER_CONTEXT &&
+ fib->cont.saved_thread.local_storage != NULL) {
+ size += st_memsize(fib->cont.saved_thread.local_storage);
}
+ size += cont_memsize(&fib->cont);
return size;
}