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

ruby-changes:16994

From: akr <ko1@a...>
Date: Sun, 15 Aug 2010 00:16:31 +0900 (JST)
Subject: [ruby-changes:16994] Ruby:r28990 (trunk): * ext/pathname/pathname.c (path_utime): Pathname#utime translated

akr	2010-08-15 00:16:19 +0900 (Sun, 15 Aug 2010)

  New Revision: 28990

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

  Log:
    * ext/pathname/pathname.c (path_utime): Pathname#utime translated
      from pathname.rb.

  Modified files:
    trunk/ChangeLog
    trunk/ext/pathname/lib/pathname.rb
    trunk/ext/pathname/pathname.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28989)
+++ ChangeLog	(revision 28990)
@@ -1,3 +1,8 @@
+Sun Aug 15 00:15:45 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_utime): Pathname#utime translated
+	  from pathname.rb.
+
 Sat Aug 14 21:04:28 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* thread.c (rb_gc_mark_threads): deprecated.
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 28989)
+++ ext/pathname/lib/pathname.rb	(revision 28990)
@@ -512,9 +512,6 @@
 
 class Pathname    # * File *
 
-  # See <tt>File.utime</tt>.  Update the access and modification times.
-  def utime(atime, mtime) File.utime(atime, mtime, @path) end
-
   # See <tt>File.basename</tt>.  Returns the last component of the path.
   def basename(*args) self.class.new(File.basename(@path, *args)) end
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 28989)
+++ ext/pathname/pathname.c	(revision 28990)
@@ -415,6 +415,15 @@
 }
 
 /*
+ * See <tt>File.utime</tt>.  Update the access and modification times.
+ */
+static VALUE
+path_utime(VALUE self, VALUE atime, VALUE mtime)
+{
+    return rb_funcall(rb_cFile, rb_intern("utime"), 3, atime, mtime, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -632,4 +641,5 @@
     rb_define_method(rb_cPathname, "lstat", path_lstat, 0);
     rb_define_method(rb_cPathname, "make_symlink", path_make_symlink, 1);
     rb_define_method(rb_cPathname, "truncate", path_truncate, 1);
+    rb_define_method(rb_cPathname, "utime", path_utime, 2);
 }

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

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