diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-01 15:18:51 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-01 15:18:51 +0000 |
commit | b4621c9aaed7e18e377b2e36f41b61f0960997d8 (patch) | |
tree | e951cb88463cec6092a07ec14bef76d5ddb9900b | |
parent | 44396dbe123511678710cfb21223c954b9ceaafb (diff) |
make Dir object WB protected.
* dir.c (dir_data_type): set RUBY_TYPED_WB_PROTECTED.
Insert WBs for dir_data::path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | dir.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -437,7 +437,7 @@ VALUE rb_cDir; struct dir_data { DIR *dir; - VALUE path; + const VALUE path; rb_encoding *enc; }; @@ -466,7 +466,7 @@ dir_memsize(const void *ptr) static const rb_data_type_t dir_data_type = { "dir", {dir_mark, dir_free, dir_memsize,}, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY + 0, 0, RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FREE_IMMEDIATELY }; static VALUE dir_close(VALUE); @@ -487,7 +487,7 @@ dir_s_alloc(VALUE klass) VALUE obj = TypedData_Make_Struct(klass, struct dir_data, &dir_data_type, dirp); dirp->dir = NULL; - dirp->path = Qnil; + RB_OBJ_WRITE(obj, &dirp->path, Qnil); dirp->enc = NULL; return obj; @@ -536,7 +536,7 @@ dir_initialize(int argc, VALUE *argv, VALUE dir) TypedData_Get_Struct(dir, struct dir_data, &dir_data_type, dp); if (dp->dir) closedir(dp->dir); dp->dir = NULL; - dp->path = Qnil; + RB_OBJ_WRITE(dir, &dp->path, Qnil); dp->enc = fsenc; path = RSTRING_PTR(dirname); dp->dir = opendir(path); @@ -559,7 +559,7 @@ dir_initialize(int argc, VALUE *argv, VALUE dir) rb_syserr_fail_path(e, orig); } } - dp->path = orig; + RB_OBJ_WRITE(dir, &dp->path, orig); return dir; } |