[前][次][番号順一覧][スレッド一覧]

ruby-changes:24227

From: naruse <ko1@a...>
Date: Tue, 3 Jul 2012 11:45:02 +0900 (JST)
Subject: [ruby-changes:24227] naruse:r36278 (ruby_1_9_3): merge revision(s) 34348:

naruse	2012-07-03 11:44:05 +0900 (Tue, 03 Jul 2012)

  New Revision: 36278

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36278

  Log:
    merge revision(s) 34348:
    
    * dir.c (dir_chdir, check_dirname): get rid of optimization-out.

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/dir.c
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 36277)
+++ ruby_1_9_3/ChangeLog	(revision 36278)
@@ -1,3 +1,7 @@
+Tue Jul  3 11:43:46 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* dir.c (dir_chdir, check_dirname): get rid of optimization-out.
+
 Thu Jun 28 17:57:49 2012  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (is_socket, is_console): add prototypes to fix compile
Index: ruby_1_9_3/dir.c
===================================================================
--- ruby_1_9_3/dir.c	(revision 36277)
+++ ruby_1_9_3/dir.c	(revision 36278)
@@ -762,7 +762,6 @@
 static void
 dir_chdir(VALUE path)
 {
-    path = rb_str_encode_ospath(path);
     if (chdir(RSTRING_PTR(path)) < 0)
 	rb_sys_fail_path(path);
 }
@@ -845,6 +844,7 @@
     rb_secure(2);
     if (rb_scan_args(argc, argv, "01", &path) == 1) {
 	FilePathValue(path);
+	path = rb_str_encode_ospath(path);
     }
     else {
 	const char *dist = getenv("HOME");
@@ -862,9 +862,8 @@
 
     if (rb_block_given_p()) {
 	struct chdir_data args;
-	char *cwd = my_getcwd();
 
-	args.old_path = rb_tainted_str_new2(cwd); xfree(cwd);
+	args.old_path = rb_str_encode_ospath(rb_dir_getwd());
 	args.new_path = path;
 	args.done = FALSE;
 	return rb_ensure(chdir_yield, (VALUE)&args, chdir_restore, (VALUE)&args);
@@ -909,14 +908,16 @@
 static void
 check_dirname(volatile VALUE *dir)
 {
+    VALUE d = *dir;
     char *path, *pend;
 
     rb_secure(2);
-    FilePathValue(*dir);
-    path = RSTRING_PTR(*dir);
+    FilePathValue(d);
+    path = RSTRING_PTR(d);
     if (path && *(pend = rb_path_end(rb_path_skip_prefix(path)))) {
-	*dir = rb_str_new(path, pend - path);
+	d = rb_str_subseq(d, 0, pend - path);
     }
+    *dir = rb_str_encode_ospath(d);
 }
 
 #if defined(HAVE_CHROOT)
@@ -933,8 +934,6 @@
 dir_s_chroot(VALUE dir, VALUE path)
 {
     check_dirname(&path);
-
-    path = rb_str_encode_ospath(path);
     if (chroot(RSTRING_PTR(path)) == -1)
 	rb_sys_fail_path(path);
 
@@ -973,7 +972,6 @@
     }
 
     check_dirname(&path);
-    path = rb_str_encode_ospath(path);
     if (mkdir(RSTRING_PTR(path), mode) == -1)
 	rb_sys_fail_path(path);
 
@@ -993,7 +991,6 @@
 dir_s_rmdir(VALUE obj, VALUE dir)
 {
     check_dirname(&dir);
-    dir = rb_str_encode_ospath(dir);
     if (rmdir(RSTRING_PTR(dir)) < 0)
 	rb_sys_fail_path(dir);
 
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 36277)
+++ ruby_1_9_3/version.h	(revision 36278)
@@ -1,10 +1,10 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 243
+#define RUBY_PATCHLEVEL 244
 
-#define RUBY_RELEASE_DATE "2012-06-28"
+#define RUBY_RELEASE_DATE "2012-07-03"
 #define RUBY_RELEASE_YEAR 2012
-#define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 28
+#define RUBY_RELEASE_MONTH 7
+#define RUBY_RELEASE_DAY 3
 
 #include "ruby/version.h"
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]