summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--lib/irb/extend-command.rb4
-rw-r--r--lib/irb/ruby-lex.rb2
-rw-r--r--lib/net/smtp.rb6
-rw-r--r--lib/parsearg.rb2
-rw-r--r--numeric.c23
-rw-r--r--re.c3
7 files changed, 31 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index ced20623db..37e502cef3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Sat Jul 27 23:07:52 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_to_int): default to_int implementaion for every
+ numeric class.
+
+Sat Jul 27 08:09:03 2002 Booker C. Bense <bbense@slac.stanford.edu>
+
+ * re.c (rb_reg_quote): initial part of the string was never copied
+ to the quoted string.
+
Fri Jul 26 23:03:53 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* eval.c (rb_eval): no need to convert to string twice.
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index fd71968c1f..cfb2c7c4be 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -104,7 +104,7 @@ module IRB
def EXCB.install_extend_commands
for args in @EXTEND_COMMANDS
- def_extend_command *args
+ def_extend_command(*args)
end
end
@@ -193,7 +193,7 @@ module IRB
def CE.install_extend_commands
for args in @EXTEND_COMMANDS
- def_extend_command *args
+ def_extend_command(*args)
end
end
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index e96edef30b..1bf47c1235 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -737,7 +737,7 @@ class RubyLex
def identify_identifier
token = ""
if peek(0) =~ /[$@]/
- token.concat (c = getc)
+ token.concat(c = getc)
if c == "@" and peek(0) == "@"
token.concat getc
end
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 8652f0f5d0..a3802f6cb0 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -289,14 +289,14 @@ module Net
def send_mail( mailsrc, from_addr, *to_addrs )
do_ready from_addr, to_addrs.flatten
- command().write_mail mailsrc
+ command().write_mail(mailsrc)
end
alias sendmail send_mail
def ready( from_addr, *to_addrs, &block )
do_ready from_addr, to_addrs.flatten
- command().through_mail &block
+ command().through_mail(&block)
end
private
@@ -304,7 +304,7 @@ module Net
def do_ready( from_addr, to_addrs )
raise ArgumentError, 'mail destination does not given' if to_addrs.empty?
command().mailfrom from_addr
- command().rcpt to_addrs
+ command().rcpt(to_addrs)
end
end
diff --git a/lib/parsearg.rb b/lib/parsearg.rb
index b9f41d5e5f..d5f3c9638d 100644
--- a/lib/parsearg.rb
+++ b/lib/parsearg.rb
@@ -73,7 +73,7 @@ def parseArgs(argc, nopt, single_opts, *opts)
end
rescue
print "Format Error!! : \"" + nopt + "\"\t[parseArgs]\n"
- exit! -1
+ exit!(-1)
end
end
if ARGV.length < argc
diff --git a/numeric.c b/numeric.c
index bb2ed583b1..f485987467 100644
--- a/numeric.c
+++ b/numeric.c
@@ -200,6 +200,13 @@ num_nonzero_p(num)
return num;
}
+static VALUE
+num_to_int(num)
+ VALUE num;
+{
+ return rb_funcall(num, id_to_i, 0, 0);
+}
+
VALUE
rb_float_new(d)
double d;
@@ -838,7 +845,7 @@ rb_num2long(val)
VALUE val;
{
if (NIL_P(val)) {
- rb_raise(rb_eTypeError, "no implicit conversion to integer from nil");
+ rb_raise(rb_eTypeError, "no implicit conversion from nil to integer");
}
if (FIXNUM_P(val)) return FIX2LONG(val);
@@ -861,16 +868,6 @@ rb_num2long(val)
case T_BIGNUM:
return rb_big2long(val);
-#if 0
- case T_STRING:
- rb_raise(rb_eTypeError, "no implicit conversion to integer from string");
- return Qnil; /* not reached */
-
- case T_TRUE:
- case T_FALSE:
- rb_raise(rb_eTypeError, "no implicit conversion to integer from boolean");
- return Qnil; /* not reached */
-#endif
default:
val = rb_to_int(val);
return NUM2LONG(val);
@@ -1052,7 +1049,7 @@ rb_int_induced_from(klass, x)
case T_BIGNUM:
return x;
case T_FLOAT:
- return rb_funcall(x, rb_intern("to_i"), 0);
+ return rb_funcall(x, id_to_i, 0);
default:
rb_raise(rb_eTypeError, "failed to convert %s into Integer",
rb_class2name(CLASS_OF(x)));
@@ -1635,6 +1632,7 @@ Init_Numeric()
rb_define_method(rb_cNumeric, "modulo", num_modulo, 1);
rb_define_method(rb_cNumeric, "remainder", num_remainder, 1);
rb_define_method(rb_cNumeric, "abs", num_abs, 0);
+ rb_define_method(rb_cNumeric, "to_int", num_to_int, 0);
rb_define_method(rb_cNumeric, "integer?", num_int_p, 0);
rb_define_method(rb_cNumeric, "zero?", num_zero_p, 0);
@@ -1739,6 +1737,7 @@ Init_Numeric()
rb_define_method(rb_cFloat, "zero?", flo_zero_p, 0);
rb_define_method(rb_cFloat, "to_i", flo_truncate, 0);
+ rb_define_method(rb_cFloat, "to_int", flo_truncate, 0);
rb_define_method(rb_cFloat, "floor", flo_floor, 0);
rb_define_method(rb_cFloat, "ceil", flo_ceil, 0);
rb_define_method(rb_cFloat, "round", flo_round, 0);
diff --git a/re.c b/re.c
index 90999a9572..5663f02919 100644
--- a/re.c
+++ b/re.c
@@ -1205,6 +1205,9 @@ rb_reg_quote(str)
meta_found:
tmp = rb_str_new(0, RSTRING(str)->len*2);
t = RSTRING(tmp)->ptr;
+ /* copy upto metacharacter */
+ memcpy(t, RSTRING(str)->ptr, s - RSTRING(str)->ptr);
+ t += s - RSTRING(str)->ptr;
for (; s < send; s++) {
c = *s;