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
This commit is contained in:
parent
161deb2196
commit
d2e3c03409
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
|||||||
|
Sat Sep 13 14:14:00 2014 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
|
* 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
|
||||||
|
|
||||||
Sat Sep 13 13:43:07 2014 Eric Wong <e@80x24.org>
|
Sat Sep 13 13:43:07 2014 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
* doc/NEWS-2.0.0: fix typo for default RUBY_FIBER_MACHINE_STACK_SIZE
|
* doc/NEWS-2.0.0: fix typo for default RUBY_FIBER_MACHINE_STACK_SIZE
|
||||||
|
10
process.c
10
process.c
@ -1348,21 +1348,15 @@ mark_exec_arg(void *ptr)
|
|||||||
rb_gc_mark(eargp->chdir_dir);
|
rb_gc_mark(eargp->chdir_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
free_exec_arg(void *ptr)
|
|
||||||
{
|
|
||||||
xfree(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
memsize_exec_arg(const void *ptr)
|
memsize_exec_arg(const void *ptr)
|
||||||
{
|
{
|
||||||
return ptr ? sizeof(struct rb_execarg) : 0;
|
return sizeof(struct rb_execarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const rb_data_type_t exec_arg_data_type = {
|
static const rb_data_type_t exec_arg_data_type = {
|
||||||
"exec_arg",
|
"exec_arg",
|
||||||
{mark_exec_arg, free_exec_arg, memsize_exec_arg},
|
{mark_exec_arg, RUBY_TYPED_DEFAULT_FREE, memsize_exec_arg},
|
||||||
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
|
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
11
variable.c
11
variable.c
@ -1543,7 +1543,7 @@ static size_t
|
|||||||
autoload_memsize(const void *ptr)
|
autoload_memsize(const void *ptr)
|
||||||
{
|
{
|
||||||
const st_table *tbl = ptr;
|
const st_table *tbl = ptr;
|
||||||
return tbl ? st_memsize(tbl) : 0;
|
return st_memsize(tbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const rb_data_type_t autoload_data_type = {
|
static const rb_data_type_t autoload_data_type = {
|
||||||
@ -1584,13 +1584,6 @@ autoload_i_mark(void *ptr)
|
|||||||
rb_gc_mark(p->value);
|
rb_gc_mark(p->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
autoload_i_free(void *ptr)
|
|
||||||
{
|
|
||||||
struct autoload_data_i *p = ptr;
|
|
||||||
xfree(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
autoload_i_memsize(const void *ptr)
|
autoload_i_memsize(const void *ptr)
|
||||||
{
|
{
|
||||||
@ -1599,7 +1592,7 @@ autoload_i_memsize(const void *ptr)
|
|||||||
|
|
||||||
static const rb_data_type_t autoload_data_i_type = {
|
static const rb_data_type_t autoload_data_i_type = {
|
||||||
"autoload_i",
|
"autoload_i",
|
||||||
{autoload_i_mark, autoload_i_free, autoload_i_memsize,},
|
{autoload_i_mark, RUBY_TYPED_DEFAULT_FREE, autoload_i_memsize,},
|
||||||
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
|
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -72,11 +72,9 @@ struct valued_frame_info {
|
|||||||
static void
|
static void
|
||||||
location_mark(void *ptr)
|
location_mark(void *ptr)
|
||||||
{
|
{
|
||||||
if (ptr) {
|
|
||||||
struct valued_frame_info *vfi = (struct valued_frame_info *)ptr;
|
struct valued_frame_info *vfi = (struct valued_frame_info *)ptr;
|
||||||
rb_gc_mark(vfi->btobj);
|
rb_gc_mark(vfi->btobj);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
location_mark_entry(rb_backtrace_location_t *fi)
|
location_mark_entry(rb_backtrace_location_t *fi)
|
||||||
@ -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
|
static size_t
|
||||||
location_memsize(const void *ptr)
|
location_memsize(const void *ptr)
|
||||||
{
|
{
|
||||||
@ -111,7 +100,7 @@ location_memsize(const void *ptr)
|
|||||||
|
|
||||||
static const rb_data_type_t location_data_type = {
|
static const rb_data_type_t location_data_type = {
|
||||||
"frame_info",
|
"frame_info",
|
||||||
{location_mark, location_free, location_memsize,},
|
{location_mark, RUBY_TYPED_DEFAULT_FREE, location_memsize,},
|
||||||
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
|
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -378,7 +367,6 @@ typedef struct rb_backtrace_struct {
|
|||||||
static void
|
static void
|
||||||
backtrace_mark(void *ptr)
|
backtrace_mark(void *ptr)
|
||||||
{
|
{
|
||||||
if (ptr) {
|
|
||||||
rb_backtrace_t *bt = (rb_backtrace_t *)ptr;
|
rb_backtrace_t *bt = (rb_backtrace_t *)ptr;
|
||||||
size_t i, s = bt->backtrace_size;
|
size_t i, s = bt->backtrace_size;
|
||||||
|
|
||||||
@ -388,17 +376,14 @@ backtrace_mark(void *ptr)
|
|||||||
rb_gc_mark(bt->strary);
|
rb_gc_mark(bt->strary);
|
||||||
rb_gc_mark(bt->locary);
|
rb_gc_mark(bt->locary);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
backtrace_free(void *ptr)
|
backtrace_free(void *ptr)
|
||||||
{
|
{
|
||||||
if (ptr) {
|
|
||||||
rb_backtrace_t *bt = (rb_backtrace_t *)ptr;
|
rb_backtrace_t *bt = (rb_backtrace_t *)ptr;
|
||||||
if (bt->backtrace) ruby_xfree(bt->backtrace_base);
|
if (bt->backtrace) ruby_xfree(bt->backtrace_base);
|
||||||
ruby_xfree(bt);
|
ruby_xfree(bt);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
backtrace_memsize(const void *ptr)
|
backtrace_memsize(const void *ptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user