From 9848f0d0ca3b086383a0df3a5baed973b6bafa26 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 21 Dec 2012 13:06:17 +0000 Subject: [PATCH] * win32/{dir.h,win32.c} (rb_w32_readdir): removed old rb_w32_readdir() and renamed from rb_w32_readdir_with_enc(). [ruby-core:24864] [Feature #1927] * dir.c (READDIR): follow above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ dir.c | 2 +- win32/dir.h | 15 +++++++-------- win32/win32.c | 11 ++--------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c4d5a4c12..0d877818f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Dec 21 22:02:00 2012 NAKAMURA Usaku + + * win32/{dir.h,win32.c} (rb_w32_readdir): removed old rb_w32_readdir() + and renamed from rb_w32_readdir_with_enc(). + [ruby-core:24864] [Feature #1927] + + * dir.c (READDIR): follow above change. + Fri Dec 21 21:12:54 2012 Masaya Tarui * vm_dump.c (rb_vm_bugreport): commentout addr2line call temporarily diff --git a/dir.c b/dir.c index 4d7208692e..758a34eee6 100644 --- a/dir.c +++ b/dir.c @@ -522,7 +522,7 @@ dir_path(VALUE dir) #if defined HAVE_READDIR_R # define READDIR(dir, enc, entry, dp) (readdir_r((dir), (entry), &(dp)) == 0 && (dp) != 0) #elif defined _WIN32 -# define READDIR(dir, enc, entry, dp) (((dp) = rb_w32_readdir_with_enc((dir), (enc))) != 0) +# define READDIR(dir, enc, entry, dp) (((dp) = rb_w32_readdir((dir), (enc))) != 0) #else # define READDIR(dir, enc, entry, dp) (((dp) = readdir(dir)) != 0) #endif diff --git a/win32/dir.h b/win32/dir.h index 12a0e92b36..0e1bff0846 100644 --- a/win32/dir.h +++ b/win32/dir.h @@ -29,18 +29,17 @@ typedef struct { DIR* rb_w32_opendir(const char*); DIR* rb_w32_uopendir(const char*); -struct direct* rb_w32_readdir(DIR *); -struct direct* rb_w32_readdir_with_enc(DIR *, rb_encoding *); +struct direct* rb_w32_readdir(DIR *, rb_encoding *); long rb_w32_telldir(DIR *); void rb_w32_seekdir(DIR *, long); void rb_w32_rewinddir(DIR *); void rb_w32_closedir(DIR *); -#define opendir rb_w32_opendir -#define readdir rb_w32_readdir -#define telldir rb_w32_telldir -#define seekdir rb_w32_seekdir -#define rewinddir rb_w32_rewinddir -#define closedir rb_w32_closedir +#define opendir(s) rb_w32_opendir((s)) +#define readdir(d) rb_w32_readdir((d), 0) +#define telldir(d) rb_w32_telldir((d)) +#define seekdir(d, l) rb_w32_seekdir((d), (l)) +#define rewinddir(d) rb_w32_rewinddir((d)) +#define closedir(d) rb_w32_closedir((d)) #endif /* RUBY_WIN32_DIR_H */ diff --git a/win32/win32.c b/win32/win32.c index d68a295f91..3b827662a7 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2025,16 +2025,9 @@ readdir_internal(DIR *dirp, BOOL (*conv)(const WCHAR *, struct direct *, rb_enco /* License: Ruby's */ struct direct * -rb_w32_readdir(DIR *dirp) +rb_w32_readdir(DIR *dirp, rb_encoding *enc) { - return readdir_internal(dirp, win32_direct_conv, NULL); -} - -/* License: Ruby's */ -struct direct * -rb_w32_readdir_with_enc(DIR *dirp, rb_encoding *enc) -{ - if (enc == rb_ascii8bit_encoding()) + if (!enc || enc == rb_ascii8bit_encoding()) return readdir_internal(dirp, win32_direct_conv, NULL); else return readdir_internal(dirp, ruby_direct_conv, enc);