ruby-changes:5211
From: mame <ko1@a...>
Date: Fri, 30 May 2008 22:32:57 +0900 (JST)
Subject: [ruby-changes:5211] Ruby:r16706 (trunk): * signal.c (esignal_signo): fix SignalException#signo which returned
mame 2008-05-30 22:32:39 +0900 (Fri, 30 May 2008) New Revision: 16706 Modified files: trunk/ChangeLog trunk/signal.c Log: * signal.c (esignal_signo): fix SignalException#signo which returned nil absolutely. * signal.c (esignal_init): always prepend "SIG" to a string that is returned by SignalException#signm. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16706&r2=16705&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/signal.c?r1=16706&r2=16705&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 16705) +++ ChangeLog (revision 16706) @@ -1,3 +1,11 @@ +Fri May 30 22:28:03 2008 Yusuke Endoh <mame@t...> + + * signal.c (esignal_signo): fix SignalException#signo which returned + nil absolutely. + + * signal.c (esignal_init): always prepend "SIG" to a string that is + returned by SignalException#signm. + Fri May 30 22:17:39 2008 Yusuke Endoh <mame@t...> * test/ruby/test_argf.rb: rename a conflicting method name. Index: signal.c =================================================================== --- signal.c (revision 16705) +++ signal.c (revision 16706) @@ -253,9 +253,7 @@ if (!signo) { rb_raise(rb_eArgError, "unsupported name `SIG%s'", signm); } - if (SYMBOL_P(sig)) { - sig = rb_str_new2(signm); - } + sig = rb_sprintf("SIG%s", signm); } rb_call_super(1, &sig); rb_iv_set(self, "signo", INT2NUM(signo)); @@ -263,7 +261,20 @@ return self; } +/* + * call-seq: + * signal_exception.signo => num + * + * Returns a signal number. + */ + static VALUE +esignal_signo(VALUE self) +{ + return rb_iv_get(self, "signo"); +} + +static VALUE interrupt_init(int argc, VALUE *argv, VALUE self) { VALUE args[2]; @@ -1070,7 +1081,7 @@ rb_define_module_function(mSignal, "list", sig_list, 0); rb_define_method(rb_eSignal, "initialize", esignal_init, -1); - rb_attr(rb_eSignal, rb_intern("signo"), 1, 0, 0); + rb_define_method(rb_eSignal, "signo", esignal_signo, 0); rb_alias(rb_eSignal, rb_intern("signm"), rb_intern("message")); rb_define_method(rb_eInterrupt, "initialize", interrupt_init, -1); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/