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
This commit is contained in:
parent
000169c591
commit
dbb5595649
10
file.c
10
file.c
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user