diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-01 01:44:47 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-01 01:44:47 +0000 |
commit | dbb55956496984550f1144781cac75f1d7f82afd (patch) | |
tree | a6f78d17c93556d8b7ea33f61a03ef7458da8ea7 | |
parent | 000169c59147cf023b624bac60f456e78e50c42a (diff) | |
download | ruby-dbb55956496984550f1144781cac75f1d7f82afd.tar.gz |
file.c: remove unnecessary volatile use
For apply2files, all callers use the `path' VALUE for
generating exceptions, so there is no need to guard it.
In realpath_rec, RB_GC_GUARD is already used on link_orig.
In rb_check_realpath_internal, RB_GC_GUARD is necessary and
preferable (see Appendix E. of doc/extension.rdoc)
* file.c (apply2files): remove unnecessary volatile
(realpath_rec): ditto
(rb_check_realpath_internal): ditto, and add RB_GC_GUARD
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | file.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -358,7 +358,7 @@ static VALUE apply2files(void (*func)(const char *, VALUE, void *), int argc, VALUE *argv, void *arg) { long i; - volatile VALUE path; + VALUE path; for (i=0; i<argc; i++) { const char *s; @@ -3902,7 +3902,7 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, #ifdef HAVE_READLINK if (S_ISLNK(sbuf.st_mode)) { VALUE link; - volatile VALUE link_orig = Qnil; + VALUE link_orig = Qnil; const char *link_prefix, *link_names; long link_prefixlen; rb_hash_aset(loopcheck, testpath, ID2SYM(resolving)); @@ -3943,9 +3943,9 @@ rb_check_realpath_internal(VALUE basedir, VALUE path, enum rb_realpath_mode mode { long prefixlen; VALUE resolved; - volatile VALUE unresolved_path; + VALUE unresolved_path; VALUE loopcheck; - volatile VALUE curdir = Qnil; + VALUE curdir = Qnil; rb_encoding *enc, *origenc; char *path_names = NULL, *basedir_names = NULL, *curdir_names = NULL; @@ -4028,6 +4028,8 @@ rb_check_realpath_internal(VALUE basedir, VALUE path, enum rb_realpath_mode mode } OBJ_TAINT(resolved); + RB_GC_GUARD(unresolved_path); + RB_GC_GUARD(curdir); return resolved; } |