summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-29 14:05:15 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-29 14:05:15 +0000
commit7d87fac63ad2f1a798c7fed4b424f1fc5763470c (patch)
tree92fc4219b0696f5f2f7b89998c7d20123b3b5a7f /ruby.c
parent77e876615da5f1482b225bd4f754b9fefcd52cec (diff)
eban
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ruby.c b/ruby.c
index 632d87ef55..961aeb5866 100644
--- a/ruby.c
+++ b/ruby.c
@@ -115,7 +115,7 @@ rubylib_mangle(s, l)
{
static char *newp, *oldp;
static int newl, oldl, notfound;
- static char ret[STATIC_FILE_LENGTH+1];
+ static char newsub[STATIC_FILE_LENGTH+1];
if (!newp && !notfound) {
newp = getenv("RUBYLIB_PREFIX");
@@ -133,8 +133,8 @@ rubylib_mangle(s, l)
if (newl == 0 || oldl == 0 || newl > STATIC_FILE_LENGTH) {
rb_fatal("malformed RUBYLIB_PREFIX");
}
- strcpy(ret, newp);
- s = ret;
+ strcpy(newsub, newp);
+ s = newsub;
while (*s) {
if (*s == '\\') *s = '/';
s++;
@@ -147,6 +147,7 @@ rubylib_mangle(s, l)
l = strlen(s);
}
if (!newp || l < oldl || strncasecmp(oldp, s, oldl) != 0) {
+ static char ret[STATIC_FILE_LENGTH+1];
strncpy(ret, s, l);
ret[l] = 0;
return ret;
@@ -154,9 +155,9 @@ rubylib_mangle(s, l)
if (l + newl - oldl > STATIC_FILE_LENGTH || newl > STATIC_FILE_LENGTH) {
rb_fatal("malformed RUBYLIB_PREFIX");
}
- strcpy(ret + newl, s + oldl);
- ret[l + newl - oldl] = 0;
- return ret;
+ strcpy(newsub + newl, s + oldl);
+ newsub[l + newl - oldl] = 0;
+ return newsub;
}
#define rubylib_mangled_path(s, l) rb_str_new2(rubylib_mangle((s), (l)))
#define rubylib_mangled_path2(s) rb_str_new2(rubylib_mangle((s), 0))