summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-13 05:14:51 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-13 05:14:51 (GMT)
commitd2e3c034091ce3772e9cc12d2cbb4b0fe99b25bb (patch)
tree123d8479e54f2e779f7a24e8c3b3fd3112374a14 /vm_backtrace.c
parent161deb2196ecaca67d00ce64e3eb871946fab4aa (diff)
simplify some trivial rb_data_type_t callbacks
* process.c (free_exec_arg): remove (memsize_exec_arg): ptr is never NULL (exec_arg_data_type): use RUBY_TYPED_DEFAULT_FREE * variable.c (autoload_i_free): remove (autoload_data_i_type): use RUBY_TYPED_DEFAULT_FREE (autoload_memsize): ptr is never NULL * vm_backtrace.c (location_free): remove (location_mark): ptr is never NULL (location_data_type): use RUBY_TYPED_DEFAULT_FREE (backtrace_mark): ditto (backtrace_free): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index 7355a5f..9948654 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -72,10 +72,8 @@ struct valued_frame_info {
static void
location_mark(void *ptr)
{
- if (ptr) {
- struct valued_frame_info *vfi = (struct valued_frame_info *)ptr;
- rb_gc_mark(vfi->btobj);
- }
+ struct valued_frame_info *vfi = (struct valued_frame_info *)ptr;
+ rb_gc_mark(vfi->btobj);
}
static void
@@ -93,15 +91,6 @@ location_mark_entry(rb_backtrace_location_t *fi)
}
}
-static void
-location_free(void *ptr)
-{
- if (ptr) {
- rb_backtrace_location_t *fi = (rb_backtrace_location_t *)ptr;
- ruby_xfree(fi);
- }
-}
-
static size_t
location_memsize(const void *ptr)
{
@@ -111,7 +100,7 @@ location_memsize(const void *ptr)
static const rb_data_type_t location_data_type = {
"frame_info",
- {location_mark, location_free, location_memsize,},
+ {location_mark, RUBY_TYPED_DEFAULT_FREE, location_memsize,},
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
@@ -378,26 +367,22 @@ typedef struct rb_backtrace_struct {
static void
backtrace_mark(void *ptr)
{
- if (ptr) {
- rb_backtrace_t *bt = (rb_backtrace_t *)ptr;
- size_t i, s = bt->backtrace_size;
+ rb_backtrace_t *bt = (rb_backtrace_t *)ptr;
+ size_t i, s = bt->backtrace_size;
- for (i=0; i<s; i++) {
- location_mark_entry(&bt->backtrace[i]);
- }
- rb_gc_mark(bt->strary);
- rb_gc_mark(bt->locary);
+ for (i=0; i<s; i++) {
+ location_mark_entry(&bt->backtrace[i]);
}
+ rb_gc_mark(bt->strary);
+ rb_gc_mark(bt->locary);
}
static void
backtrace_free(void *ptr)
{
- if (ptr) {
- rb_backtrace_t *bt = (rb_backtrace_t *)ptr;
- if (bt->backtrace) ruby_xfree(bt->backtrace_base);
- ruby_xfree(bt);
- }
+ rb_backtrace_t *bt = (rb_backtrace_t *)ptr;
+ if (bt->backtrace) ruby_xfree(bt->backtrace_base);
+ ruby_xfree(bt);
}
static size_t