ruby.c: remove mangled_path
* ruby.c (rubylib_mangled_path): remove obsolete code, which has been disabled since 5 years ago. * man/ruby.1 (ENVIRONMENT): delete an obsolete variable to mangle path, RUBYLIB_PREFIX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
17eb86eb12
commit
6613580145
@ -432,7 +432,7 @@ after printing its version.
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
.Bl -tag -width "RUBYLIB_PREFIX" -compact
|
.Bl -tag -width "RUBYSHELL" -compact
|
||||||
.It Ev RUBYLIB
|
.It Ev RUBYLIB
|
||||||
A colon-separated list of directories that are added to Ruby's
|
A colon-separated list of directories that are added to Ruby's
|
||||||
library load path
|
library load path
|
||||||
@ -472,9 +472,6 @@ variable is not defined, Ruby refers to
|
|||||||
Ruby refers to the
|
Ruby refers to the
|
||||||
.Ev PATH
|
.Ev PATH
|
||||||
environment variable on calling Kernel#system.
|
environment variable on calling Kernel#system.
|
||||||
.Pp
|
|
||||||
.It Ev RUBYLIB_PREFIX
|
|
||||||
This variable is obsolete.
|
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
And Ruby depends on some RubyGems related environment variables unless RubyGems is disabled.
|
And Ruby depends on some RubyGems related environment variables unless RubyGems is disabled.
|
||||||
|
51
ruby.c
51
ruby.c
@ -207,49 +207,7 @@ usage(const char *name, int help)
|
|||||||
SHOW(features[i]);
|
SHOW(features[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MANGLED_PATH
|
#define rubylib_path_new rb_str_new
|
||||||
static VALUE
|
|
||||||
rubylib_mangled_path(const char *s, unsigned int l)
|
|
||||||
{
|
|
||||||
static char *newp, *oldp;
|
|
||||||
static int newl, oldl, notfound;
|
|
||||||
char *ptr;
|
|
||||||
VALUE ret;
|
|
||||||
|
|
||||||
if (!newp && !notfound) {
|
|
||||||
newp = getenv("RUBYLIB_PREFIX");
|
|
||||||
if (newp) {
|
|
||||||
oldp = newp = strdup(newp);
|
|
||||||
while (*newp && !ISSPACE(*newp) && *newp != ';') {
|
|
||||||
newp = CharNext(newp); /* Skip digits. */
|
|
||||||
}
|
|
||||||
oldl = newp - oldp;
|
|
||||||
while (*newp && (ISSPACE(*newp) || *newp == ';')) {
|
|
||||||
newp = CharNext(newp); /* Skip whitespace. */
|
|
||||||
}
|
|
||||||
newl = strlen(newp);
|
|
||||||
if (newl == 0 || oldl == 0) {
|
|
||||||
rb_fatal("malformed RUBYLIB_PREFIX");
|
|
||||||
}
|
|
||||||
translit_char(newp, '\\', '/');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
notfound = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!newp || l < oldl || STRNCASECMP(oldp, s, oldl) != 0) {
|
|
||||||
return rb_str_new(s, l);
|
|
||||||
}
|
|
||||||
ret = rb_str_new(0, l + newl - oldl);
|
|
||||||
ptr = RSTRING_PTR(ret);
|
|
||||||
memcpy(ptr, newp, newl);
|
|
||||||
memcpy(ptr + newl, s + oldl, l - oldl);
|
|
||||||
ptr[l + newl - oldl] = 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define rubylib_mangled_path rb_str_new
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
push_include(const char *path, VALUE (*filter)(VALUE))
|
push_include(const char *path, VALUE (*filter)(VALUE))
|
||||||
@ -264,7 +222,7 @@ push_include(const char *path, VALUE (*filter)(VALUE))
|
|||||||
p++;
|
p++;
|
||||||
if (!*p) break;
|
if (!*p) break;
|
||||||
for (s = p; *s && *s != sep; s = CharNext(s));
|
for (s = p; *s && *s != sep; s = CharNext(s));
|
||||||
rb_ary_push(load_path, (*filter)(rubylib_mangled_path(p, s - p)));
|
rb_ary_push(load_path, (*filter)(rubylib_path_new(p, s - p)));
|
||||||
p = s;
|
p = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,15 +468,12 @@ ruby_init_loadpath_safe(int safe_level)
|
|||||||
#else
|
#else
|
||||||
extern const char ruby_exec_prefix[];
|
extern const char ruby_exec_prefix[];
|
||||||
const size_t exec_prefix_len = strlen(ruby_exec_prefix);
|
const size_t exec_prefix_len = strlen(ruby_exec_prefix);
|
||||||
#define RUBY_RELATIVE(path, len) rubylib_mangled_path((path), (len))
|
#define RUBY_RELATIVE(path, len) rubylib_path_new((path), (len))
|
||||||
#define PREFIX_PATH() RUBY_RELATIVE(ruby_exec_prefix, exec_prefix_len)
|
#define PREFIX_PATH() RUBY_RELATIVE(ruby_exec_prefix, exec_prefix_len)
|
||||||
#endif
|
#endif
|
||||||
load_path = GET_VM()->load_path;
|
load_path = GET_VM()->load_path;
|
||||||
|
|
||||||
if (safe_level == 0) {
|
if (safe_level == 0) {
|
||||||
#ifdef MANGLED_PATH
|
|
||||||
rubylib_mangled_path("", 0);
|
|
||||||
#endif
|
|
||||||
ruby_push_include(getenv("RUBYLIB"), identical_path);
|
ruby_push_include(getenv("RUBYLIB"), identical_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user