summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-28 16:27:42 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-28 16:27:42 +0000
commit6cd74eae6e303857e96e1c363302fd432384a4e1 (patch)
tree6aac2cf91e05e4c74db02561fc3c059dae037139
parenta1494176e7f27b32f23cc7309e80101ece99f5a2 (diff)
* io.c (io_close): always calls "close" method of the receiver.
[ruby-core:6911] [ruby-core:8112] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--io.c13
-rw-r--r--sprintf.c8
3 files changed, 20 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 1abb67d..e3f1441 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,11 @@ Thu Jul 27 18:12:12 2006 WATANABE Hirofumi <eban@ruby-lang.org>
* time.c: need to declare time_utc_offset.
+Thu Jul 27 17:01:01 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (io_close): always calls "close" method of the receiver.
+ [ruby-core:6911] [ruby-core:8112]
+
Thu Jul 27 16:49:01 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_to_s): use +0900 style timezone string for local time.
diff --git a/io.c b/io.c
index 1b9cff0..1d34632 100644
--- a/io.c
+++ b/io.c
@@ -2289,16 +2289,19 @@ rb_io_close_m(io)
}
static VALUE
-io_close(io)
+io_call_close(io)
VALUE io;
{
- if (TYPE(io) == T_FILE) {
- rb_io_close(io);
- return Qnil;
- }
return rb_funcall(io, rb_intern("close"), 0, 0);
}
+static VALUE
+io_close(io)
+ VALUE io;
+{
+ return rb_rescue(io_call_close, io, 0, 0);
+}
+
/*
* call-seq:
* ios.closed? => true or false
diff --git a/sprintf.c b/sprintf.c
index 9ad7e0c..c29b9f9 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -213,7 +213,12 @@ sign_bits(base, p)
* s | Argument is a string to be substituted. If the format
* | sequence contains a precision, at most that many characters
* | will be copied.
- * u | Treat argument as an unsigned decimal number.
+ * u | Treat argument as an unsigned decimal number. Negative integers
+ * | are displayed as a 32 bit two's complement plus one for the
+ * | underlying architecture; that is, 2 ** 32 + n. However, since
+ * | Ruby has no inherent limit on bits used to represent the
+ * | integer, this value is preceded by two dots (..) in order to
+ * | indicate a infinite number of leading sign bits.
* X | Convert argument as a hexadecimal number using uppercase
* | letters. Negative numbers will be displayed with two
* | leading periods (representing an infinite string of
@@ -230,6 +235,7 @@ sign_bits(base, p)
* sprintf("%1$*2$s %2$d %1$s", "hello", 8) #=> " hello 8 hello"
* sprintf("%1$*2$s %2$d", "hello", -8) #=> "hello -8"
* sprintf("%+g:% g:%-g", 1.23, 1.23, 1.23) #=> "+1.23: 1.23:1.23"
+ * sprintf("%u", -123) #=> "..4294967173"
*/
VALUE