summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-30 12:44:41 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-30 12:44:41 +0000
commitbe2f3c58e693a6e10693153ef2422b0235661e3e (patch)
treefd2bbf91bf9980293e594a1e310b9bd7f485bbbe
parent47fd9eb6e16ca14ee9415e4e2734c28ce5eeca36 (diff)
* ext/pathname/pathname.c (path_hash): Pathname#hash translated
from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--ext/pathname/lib/pathname.rb4
-rw-r--r--ext/pathname/pathname.c8
3 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index be2e77216c..591c22abdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 30 21:43:55 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_hash): Pathname#hash translated
+ from pathname.rb.
+
Fri Jul 30 12:42:02 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/net/imap.rb (example): use IO#noecho to read password if
@@ -30,7 +35,7 @@ Thu Jul 29 22:28:35 2010 Tanaka Akira <akr@fsij.org>
* ext/pathname/pathname.c (path_cmp): Pathname#<=> translated
from pathname.rb.
-
+
Thu Jul 29 06:51:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (EXT_SRCS): add ext/json/parser/parser.c.
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index 31dc9a361f..75705ff993 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -31,10 +31,6 @@ class Pathname
# :startdoc:
- def hash # :nodoc:
- @path.hash
- end
-
# Return the path as a String.
def to_s
@path.dup
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index 7b801a1c0b..f437d7f859 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -119,6 +119,13 @@ path_cmp(VALUE self, VALUE other)
return INT2FIX(0);
}
+/* :nodoc: */
+static VALUE
+path_hash(VALUE self)
+{
+ return INT2FIX(rb_str_hash(get_strpath(self)));
+}
+
/*
* == Pathname
*
@@ -311,4 +318,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "===", path_eq, 1);
rb_define_method(rb_cPathname, "eql?", path_eq, 1);
rb_define_method(rb_cPathname, "<=>", path_cmp, 1);
+ rb_define_method(rb_cPathname, "hash", path_hash, 0);
}