1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* dln.c (translit_separator): moved back from load.c again.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-02-24 02:52:08 +00:00
parent 9afa9ba967
commit 37e11f3cce
4 changed files with 18 additions and 12 deletions

View file

@ -1,4 +1,6 @@
Wed Feb 24 09:54:58 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> Wed Feb 24 11:52:05 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dln.c (translit_separator): moved back from load.c again.
* dln_find.c: split from dln.c. * dln_find.c: split from dln.c.

13
dln.c
View file

@ -1218,6 +1218,18 @@ aix_loaderror(const char *pathname)
} }
#endif #endif
#if defined(DLN_NEEDS_ALT_SEPARATOR) && DLN_NEEDS_ALT_SEPARATOR
#define translit_separator(src) do { \
char *tmp = ALLOCA_N(char, strlen(src) + 1), *p = tmp, c; \
do { \
*p++ = ((c = *file++) == '/') ? DLN_NEEDS_ALT_SEPARATOR : c; \
} while (c); \
str = tmp; \
} while (0)
#else
#define translit_separator(str) (void)(str)
#endif
void* void*
dln_load(const char *file) dln_load(const char *file)
{ {
@ -1264,6 +1276,7 @@ dln_load(const char *file)
char *buf; char *buf;
/* Load the file as an object one */ /* Load the file as an object one */
init_funcname(&buf, file); init_funcname(&buf, file);
translit_separator(file);
#ifdef USE_DLN_DLOPEN #ifdef USE_DLN_DLOPEN
#define DLN_DEFINED #define DLN_DEFINED

11
load.c
View file

@ -536,17 +536,8 @@ load_failed(VALUE fname)
static VALUE static VALUE
load_ext(VALUE path) load_ext(VALUE path)
{ {
VALUE result;
SCOPE_SET(NOEX_PUBLIC); SCOPE_SET(NOEX_PUBLIC);
#if defined DLN_NEEDS_ALT_SEPARATOR && DLN_NEEDS_ALT_SEPARATOR return (VALUE)dln_load(RSTRING_PTR(path));
translit_char(RSTRING_PTR(path), '/', '\\');
#endif
result = (VALUE)dln_load(RSTRING_PTR(path));
#if defined DLN_NEEDS_ALT_SEPARATOR && DLN_NEEDS_ALT_SEPARATOR
translit_char(RSTRING_PTR(path), '\\', '/');
#endif
return result;
} }
VALUE VALUE

View file

@ -171,7 +171,7 @@ define config_h
@echo>>$(1) #define DLEXT_MAXLEN 4 @echo>>$(1) #define DLEXT_MAXLEN 4
@echo>>$(1) #define DLEXT ".dll" @echo>>$(1) #define DLEXT ".dll"
@echo>>$(1) #define EXECUTABLE_EXTS ".exe",".com",".cmd",".bat" @echo>>$(1) #define EXECUTABLE_EXTS ".exe",".com",".cmd",".bat"
@echo>>$(1) #define DLN_NEEDS_ALT_SEPARATOR 1 @echo>>$(1) #define DLN_NEEDS_ALT_SEPARATOR '\\'
@echo>>$(1) #define RUBY_LIB_VERSION_STYLE 3 @echo>>$(1) #define RUBY_LIB_VERSION_STYLE 3
@echo>>$(1) #define RUBY_LIB_PREFIX "C:/Data/Ruby/lib" @echo>>$(1) #define RUBY_LIB_PREFIX "C:/Data/Ruby/lib"
@echo>>$(1) #define RUBY_SITE_LIB "E:/Data/Ruby/lib" @echo>>$(1) #define RUBY_SITE_LIB "E:/Data/Ruby/lib"