ruby-changes:13478
From: usa <ko1@a...>
Date: Wed, 7 Oct 2009 10:21:48 +0900 (JST)
Subject: [ruby-changes:13478] Ruby:r25252 (win32-unicode-test): * dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): use wrapper macros
usa 2009-10-07 10:17:29 +0900 (Wed, 07 Oct 2009) New Revision: 25252 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25252 Log: * dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): use wrapper macros instead of using platform ifdefs. Modified files: branches/win32-unicode-test/ChangeLog branches/win32-unicode-test/dir.c Index: win32-unicode-test/ChangeLog =================================================================== --- win32-unicode-test/ChangeLog (revision 25251) +++ win32-unicode-test/ChangeLog (revision 25252) @@ -1,3 +1,8 @@ +Wed Oct 7 10:15:50 2009 NAKAMURA Usaku <usa@r...> + + * dir.c (dir_chdir, dir_s_mkdir, dir_s_rmdir): use wrapper macros + instead of using platform ifdefs. + Wed Sep 2 11:30:49 2009 NAKAMURA Usaku <usa@r...> * file.c (rb_stat, rb_file_lstat, eaccess, rb_file_s_ftype, Index: win32-unicode-test/dir.c =================================================================== --- win32-unicode-test/dir.c (revision 25251) +++ win32-unicode-test/dir.c (revision 25252) @@ -67,6 +67,17 @@ #define lstat stat #endif +/* define system APIs */ +#ifdef _WIN32 +#define CHDIR(p) _wchdir((WCHAR *)(p)) +#define MKDIR(p, m) rb_w32_wmkdir((WCHAR *)(p), m) +#define RMDIR(p) _wrmdir((WCHAR *)(p)) +#else +#define CHDIR(p) chdir(p) +#define MKDIR(p, m) mkdir(p, m) +#define RMDIR(p, m) rmdir(p, m) +#endif + #define FNM_NOESCAPE 0x01 #define FNM_PATHNAME 0x02 #define FNM_DOTMATCH 0x04 @@ -719,11 +730,7 @@ dir_chdir(VALUE path) { path = rb_str_conv_for_path(path); -#ifdef _WIN32 - if (_wchdir((WCHAR *)RSTRING_PTR(path)) < 0) -#else - if (chdir(RSTRING_PTR(path)) < 0) -#endif + if (CHDIR(RSTRING_PTR(path)) < 0) rb_sys_fail(RSTRING_PTR(path)); } @@ -926,11 +933,7 @@ check_dirname(&path); path = rb_str_conv_for_path(path); -#ifdef _WIN32 - if (rb_w32_wmkdir((WCHAR *)RSTRING_PTR(path), mode) == -1) -#else - if (mkdir(RSTRING_PTR(path), mode) == -1) -#endif + if (MKDIR(RSTRING_PTR(path), mode) == -1) rb_sys_fail(RSTRING_PTR(path)); return INT2FIX(0); @@ -950,11 +953,7 @@ { check_dirname(&dir); dir = rb_str_conv_for_path(dir); -#ifdef _WIN32 - if (_wrmdir((WCHAR *)RSTRING_PTR(dir)) < 0) -#else - if (rmdir(RSTRING_PTR(dir)) < 0) -#endif + if (RMDIR(RSTRING_PTR(dir)) < 0) rb_sys_fail(RSTRING_PTR(dir)); return INT2FIX(0); @@ -1605,6 +1604,12 @@ rb_ascii8bit_encoding()); } +int +ruby_brace_glob_with_enc(const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc) +{ + return ruby_brace_glob0(str, flags & ~GLOB_VERBOSE, func, arg, enc); +} + static int push_glob(VALUE ary, VALUE str, int flags) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/