Issue #8782 has been updated by akr (Akira Tanaka).


rl_getc_function ???設?????????????readline() ???????????????????????????????????????????止??????????????????????????????????

??????????????rl_getc_function ?????? read ???????????????????????????????????? blocking region ????????????????????????????????????????????????????????????

readline() ????????? blocking region ?????????????????????????????????????????????????????
----------------------------------------
Bug #8782: Don't set rl_getc_function on editline
https://bugs.ruby-lang.org/issues/8782#change-43424

Author: naruse (Yui NARUSE)
Status: Assigned
Priority: Normal
Assignee: kouji (Kouji Takao)
Category: ext
Target version: current: 2.1.0
ruby -v: ruby 2.1.0dev (2013-08-12 trunk 42528) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


r42402 以?? OS X ???? editline ???????? #define rl_getc(f) EOF ???使??????????????????????????念?????????????????????????????
???????????? editline ??? readline wrapper ??? non ASCII ??対??????????????????
(editline ???????? UTF-8 ????対???????????????readline wrapper ??? src/readline.c ??? _getc_function ??????????????? non ASCII ??????????)

???????????? rl_getc_function ???使??????????????????????????????????
以???????????????????????????????readline ??????? OS X ??? irb ?????????使???????????????????????

diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb
index 0b121c1..bc0ee77 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -94,4 +94,5 @@ readline.have_func("clear_history")
 readline.have_func("rl_redisplay")
 readline.have_func("rl_insert_text")
 readline.have_func("rl_delete_text")
+readline.have_func("el_init")
 create_makefile("readline")
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 0f76d1a..85109f0 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -130,12 +130,7 @@ static VALUE readline_instream;
 static VALUE readline_outstream;

 #if defined HAVE_RL_GETC_FUNCTION
-
-#ifndef HAVE_RL_GETC
-#define rl_getc(f) EOF
-#endif
-
-static int readline_getc(FILE *);
+# ifndef HAVE_EL_INIT
 static int
 readline_getc(FILE *input)
 {
@@ -187,6 +182,7 @@ readline_getc(FILE *input)
 #endif
     return FIX2INT(c);
 }
+# endif
 #elif defined HAVE_RL_EVENT_HOOK
 #define BUSY_WAIT 0

@@ -1771,7 +1767,9 @@ Init_readline()
     /* libedit check rl_getc_function only when rl_initialize() is called, */
     /* and using_history() call rl_initialize(). */
     /* This assignment should be placed before using_history() */
+# ifndef HAVE_EL_INIT
     rl_getc_function = readline_getc;
+# endif
 #elif defined HAVE_RL_EVENT_HOOK
     rl_event_hook = readline_event;
 #endif



-- 
http://bugs.ruby-lang.org/