From 37e11f3cce5dc533379117d216c09120b6546c26 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 24 Feb 2010 02:52:08 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 +++- dln.c | 13 +++++++++++++ load.c | 11 +---------- symbian/setup | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e193eb75a..1a3d4c7989 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ -Wed Feb 24 09:54:58 2010 Nobuyoshi Nakada +Wed Feb 24 11:52:05 2010 Nobuyoshi Nakada + + * dln.c (translit_separator): moved back from load.c again. * dln_find.c: split from dln.c. diff --git a/dln.c b/dln.c index 129c1d0bfd..b91baa61f1 100644 --- a/dln.c +++ b/dln.c @@ -1218,6 +1218,18 @@ aix_loaderror(const char *pathname) } #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* dln_load(const char *file) { @@ -1264,6 +1276,7 @@ dln_load(const char *file) char *buf; /* Load the file as an object one */ init_funcname(&buf, file); + translit_separator(file); #ifdef USE_DLN_DLOPEN #define DLN_DEFINED diff --git a/load.c b/load.c index 90d22d80ba..7551b6b629 100644 --- a/load.c +++ b/load.c @@ -536,17 +536,8 @@ load_failed(VALUE fname) static VALUE load_ext(VALUE path) { - VALUE result; - SCOPE_SET(NOEX_PUBLIC); -#if defined DLN_NEEDS_ALT_SEPARATOR && DLN_NEEDS_ALT_SEPARATOR - 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; + return (VALUE)dln_load(RSTRING_PTR(path)); } VALUE diff --git a/symbian/setup b/symbian/setup index c9e153cb62..04d30858af 100644 --- a/symbian/setup +++ b/symbian/setup @@ -171,7 +171,7 @@ define config_h @echo>>$(1) #define DLEXT_MAXLEN 4 @echo>>$(1) #define DLEXT ".dll" @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_PREFIX "C:/Data/Ruby/lib" @echo>>$(1) #define RUBY_SITE_LIB "E:/Data/Ruby/lib"