summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-14 22:41:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-14 22:41:04 +0000
commit71f4f96249e653ec65f138b52b15d777b342a6a6 (patch)
tree95552ebe0d8ac8be12dae6683292821ab88268bf /file.c
parent6a1a02ae833a2f90e59a6400cb532e49888a80d7 (diff)
* file.c (realpath_rec): use same cache.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/file.c b/file.c
index 203e7c2029..24b843e904 100644
--- a/file.c
+++ b/file.c
@@ -3087,6 +3087,8 @@ rb_file_s_absolute_path(int argc, VALUE *argv)
static void
realpath_rec(long *prefixlenp, VALUE *resolvedp, char *unresolved, VALUE loopcheck, int strict, int last)
{
+ ID resolving;
+ CONST_ID(resolving, "resolving");
while (*unresolved) {
char *testname = unresolved;
char *unresolved_firstsep = rb_path_next(unresolved);
@@ -3112,7 +3114,7 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, char *unresolved, VALUE loopche
rb_str_cat(testpath, testname, testnamelen);
checkval = rb_hash_aref(loopcheck, testpath);
if (!NIL_P(checkval)) {
- if (checkval == ID2SYM(rb_intern("resolving"))) {
+ if (checkval == ID2SYM(resolving)) {
errno = ELOOP;
rb_sys_fail(RSTRING_PTR(testpath));
}
@@ -3140,7 +3142,7 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, char *unresolved, VALUE loopche
volatile VALUE link;
char *link_prefix, *link_names;
long link_prefixlen;
- rb_hash_aset(loopcheck, testpath, ID2SYM(rb_intern("resolving")));
+ rb_hash_aset(loopcheck, testpath, ID2SYM(resolving));
link = rb_file_s_readlink(rb_cFile, testpath);
link_prefix = RSTRING_PTR(link);
link_names = skiproot(link_prefix);