summaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-25 01:14:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-25 01:14:35 +0000
commit3e8f7a765af5d80e7c48c2215adf7213f80319bf (patch)
tree20730260bd4f8f0f5a61851a68e48e273b644986 /dir.c
parentef43151b1c6a7a3a4a881a784af9bc180a2845a2 (diff)
downloadruby-3e8f7a765af5d80e7c48c2215adf7213f80319bf.tar.gz
ruby-3e8f7a765af5d80e7c48c2215adf7213f80319bf.tar.xz
ruby-3e8f7a765af5d80e7c48c2215adf7213f80319bf.zip
* dir.c (push_braces): do not reuse buffer strings. [ruby-core:03806]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dir.c b/dir.c
index 84476303a..330a9c5ee 100644
--- a/dir.c
+++ b/dir.c
@@ -1189,9 +1189,6 @@ push_braces(ary, str, flags)
if (lbrace && rbrace) {
int len = strlen(s);
- buf = rb_str_new(0, len+1);
- memcpy(RSTRING(buf)->ptr, s, lbrace-s);
- b = RSTRING(buf)->ptr + (lbrace-s);
p = lbrace;
while (*p != '}') {
t = p + 1;
@@ -1199,6 +1196,9 @@ push_braces(ary, str, flags)
/* skip inner braces */
if (*p == '{') while (*p!='}') p++;
}
+ buf = rb_str_new(0, len+1);
+ memcpy(RSTRING(buf)->ptr, s, lbrace-s);
+ b = RSTRING(buf)->ptr + (lbrace-s);
memcpy(b, t, p-t);
strcpy(b+(p-t), rbrace+1);
status = push_braces(ary, buf, flags);