mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* configure.in (MANGLED_PATH): defines for RUBYLIB_PREFIX.
* ruby.c (ruby_init_loadpath_safe): uses string as buffer. * symbian/setup (config_h): defines MANGLED_PATH. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d9d4df418b
commit
ee4fbaa37e
4 changed files with 21 additions and 18 deletions
|
@ -1,9 +1,15 @@
|
|||
Tue Mar 10 04:53:16 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Tue Mar 10 04:56:44 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in (MINIRUBY): keep macro into Makefile.
|
||||
|
||||
* configure.in (RUBY_CHECK_SIZEOF): fix for fallback.
|
||||
|
||||
* configure.in (MANGLED_PATH): defines for RUBYLIB_PREFIX.
|
||||
|
||||
* ruby.c (ruby_init_loadpath_safe): uses string as buffer.
|
||||
|
||||
* symbian/setup (config_h): defines MANGLED_PATH.
|
||||
|
||||
Tue Mar 10 03:48:27 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/dl/callback/depend: fix for parallel build.
|
||||
|
|
|
@ -1778,6 +1778,7 @@ else
|
|||
DLEXT=dll;;
|
||||
when(cygwin*|mingw*|*djgpp*)
|
||||
LOAD_RELATIVE=1
|
||||
AC_DEFINE(MANGLED_PATH)
|
||||
DLEXT=so;;
|
||||
when(*)
|
||||
DLEXT=so;;
|
||||
|
|
29
ruby.c
29
ruby.c
|
@ -169,7 +169,7 @@ usage(const char *name)
|
|||
|
||||
VALUE rb_get_load_path(void);
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__ || defined __SYMBIAN32__
|
||||
#ifdef MANGLED_PATH
|
||||
static VALUE
|
||||
rubylib_mangled_path(const char *s, unsigned int l)
|
||||
{
|
||||
|
@ -209,15 +209,8 @@ rubylib_mangled_path(const char *s, unsigned int l)
|
|||
ptr[l + newl - oldl] = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rubylib_mangled_path2(const char *s)
|
||||
{
|
||||
return rubylib_mangled_path(s, strlen(s));
|
||||
}
|
||||
#else
|
||||
#define rubylib_mangled_path rb_str_new
|
||||
#define rubylib_mangled_path2 rb_str_new_cstr
|
||||
#endif
|
||||
|
||||
static void
|
||||
|
@ -353,7 +346,7 @@ ruby_init_loadpath_safe(int safe_level)
|
|||
#if defined LOAD_RELATIVE
|
||||
char libpath[MAXPATHLEN + 1];
|
||||
char *p;
|
||||
int rest;
|
||||
int baselen;
|
||||
|
||||
libpath[0] = '\0';
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
|
@ -362,7 +355,7 @@ ruby_init_loadpath_safe(int safe_level)
|
|||
_execname(libpath, sizeof(libpath) - 1);
|
||||
#elif defined(HAVE_DLADDR)
|
||||
Dl_info dli;
|
||||
if (dladdr(ruby_init_loadpath_safe, &dli)) {
|
||||
if (dladdr(expand_include_path, &dli)) {
|
||||
strlcpy(libpath, dli.dli_fname, sizeof(libpath));
|
||||
}
|
||||
#endif
|
||||
|
@ -390,13 +383,14 @@ ruby_init_loadpath_safe(int safe_level)
|
|||
p = libpath + 1;
|
||||
}
|
||||
|
||||
rest = sizeof(libpath) - 1 - (p - libpath);
|
||||
baselen = p - libpath;
|
||||
|
||||
#define RUBY_RELATIVE(path) (strlcpy(p, (path), rest), libpath)
|
||||
#define BASEPATH() rb_str_buf_cat(rb_str_buf_new(baselen+len), libpath, baselen)
|
||||
#define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), path, len)
|
||||
#else
|
||||
#define RUBY_RELATIVE(path) (path)
|
||||
#define RUBY_RELATIVE(path, len) rubylib_mangled_path(path, len)
|
||||
#endif
|
||||
#define incpush(path) rb_ary_push(load_path, rubylib_mangled_path2(path))
|
||||
#define incpush(path) rb_ary_push(load_path, (path))
|
||||
load_path = GET_VM()->load_path;
|
||||
|
||||
if (safe_level == 0) {
|
||||
|
@ -404,12 +398,13 @@ ruby_init_loadpath_safe(int safe_level)
|
|||
}
|
||||
|
||||
while (*paths) {
|
||||
incpush(RUBY_RELATIVE(paths));
|
||||
paths += strlen(paths) + 1;
|
||||
int len = strlen(paths);
|
||||
incpush(RUBY_RELATIVE(paths, len));
|
||||
paths += len + 1;
|
||||
}
|
||||
|
||||
if (safe_level == 0) {
|
||||
incpush(".");
|
||||
rb_ary_push(load_path, rb_str_new_cstr("."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,6 +163,7 @@ define config_h
|
|||
@echo>>$(1) #define HAVE_LIBPTHREAD 1
|
||||
@echo>>$(1) #define HAVE_NANOSLEEP 1
|
||||
@echo>>$(1) #define USE_ELF 1
|
||||
@echo>>$(1) #define MANGLED_PATH 1
|
||||
@echo>>$(1) #define DLEXT_MAXLEN 4
|
||||
@echo>>$(1) #define DLEXT ".dll"
|
||||
@echo>>$(1) #define DLN_NEEDS_ALT_SEPARATOR 1
|
||||
|
|
Loading…
Reference in a new issue