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

ruby-changes:10462

From: kouji <ko1@a...>
Date: Tue, 3 Feb 2009 21:15:30 +0900 (JST)
Subject: [ruby-changes:10462] Ruby:r22012 (trunk): * ext/readline/readline.c (readline_s_set_completion_proc): set

kouji	2009-02-03 21:15:20 +0900 (Tue, 03 Feb 2009)

  New Revision: 22012

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

  Log:
    * ext/readline/readline.c (readline_s_set_completion_proc): set
      default if proc is nil. fix #1095

  Modified files:
    trunk/ChangeLog
    trunk/ext/readline/readline.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 22011)
+++ ChangeLog	(revision 22012)
@@ -1,3 +1,8 @@
+Tue Feb  3 21:07:19 2009  TAKAO Kouji  <kouji@t...>
+
+	* ext/readline/readline.c (readline_s_set_completion_proc): set
+	  default if proc is nil. fix #1095
+
 Tue Feb  3 16:36:06 2009  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* array.c (rb_ary_sort_by_bang): RDoc update.
Index: ext/readline/readline.c
===================================================================
--- ext/readline/readline.c	(revision 22011)
+++ ext/readline/readline.c	(revision 22012)
@@ -304,6 +304,8 @@
  * should take input-string, and return an array of completion
  * candidates.
  *
+ * Set default if +proc+ is nil.
+ *
  * Raises ArgumentError exception if +proc+ does not respond to call method.
  *
  * Raises SecurityError exception if $SAFE is 4.
@@ -312,7 +314,7 @@
 readline_s_set_completion_proc(VALUE self, VALUE proc)
 {
     rb_secure(4);
-    if (!rb_respond_to(proc, rb_intern("call")))
+    if (!NIL_P(proc) && !rb_respond_to(proc, rb_intern("call")))
 	rb_raise(rb_eArgError, "argument must respond to `call'");
     return rb_ivar_set(mReadline, completion_proc, proc);
 }

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

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