aboutsummaryrefslogtreecommitdiffstats
path: root/ext/readline
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-16 22:09:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-16 22:09:29 +0000
commit4d2f38b7778cd51cdf1e877d61dbb1ad2b028557 (patch)
tree37b44b95a3fbe5055110e7ac4853cf48df351234 /ext/readline
parente84ce31a9e6e82bc1980ac34eb2b8f246caf77c0 (diff)
downloadruby-4d2f38b7778cd51cdf1e877d61dbb1ad2b028557.tar.gz
* ext/readline/readline.c: suppress warnings.
* lib/irb/extend-command.rb (IRB::ContextExtender.def_extend_command): ditto. * lib/irb/ext/history.rb (IRB::Context::set_last_value): ditto. * lib/irb/ext/history.rb (IRB::Context::eval_history): ditto. * lib/irb/locale.rb (IRB::Locale::real_load): ditto. * lib/irb/slex.rb (SLex::Node::create_subnode): remove garbage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/readline.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index e3a1dcbf02..4c7b08f514 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -19,6 +19,7 @@ static VALUE mReadline;
#define COMPLETION_PROC "completion_proc"
#define COMPLETION_CASE_FOLD "completion_case_fold"
+static ID completion_proc, completion_case_fold;
#ifndef READLINE_42_OR_LATER
# define rl_filename_completion_function filename_completion_function
@@ -87,7 +88,7 @@ readline_s_set_completion_proc(self, proc)
rb_secure(4);
if (!rb_respond_to(proc, rb_intern("call")))
rb_raise(rb_eArgError, "argument must respond to `call'");
- return rb_iv_set(mReadline, COMPLETION_PROC, proc);
+ return rb_ivar_set(mReadline, completion_proc, proc);
}
static VALUE
@@ -95,7 +96,7 @@ readline_s_get_completion_proc(self)
VALUE self;
{
rb_secure(4);
- return rb_iv_get(mReadline, COMPLETION_PROC);
+ return rb_attr_get(mReadline, completion_proc);
}
static VALUE
@@ -104,7 +105,7 @@ readline_s_set_completion_case_fold(self, val)
VALUE val;
{
rb_secure(4);
- return rb_iv_set(mReadline, COMPLETION_CASE_FOLD, val);
+ return rb_ivar_set(mReadline, completion_case_fold, val);
}
static VALUE
@@ -112,7 +113,7 @@ readline_s_get_completion_case_fold(self)
VALUE self;
{
rb_secure(4);
- return rb_iv_get(mReadline, COMPLETION_CASE_FOLD);
+ return rb_attr_get(mReadline, completion_case_fold);
}
static char **
@@ -126,11 +127,11 @@ readline_attempted_completion_function(text, start, end)
int case_fold;
int i, matches;
- proc = rb_iv_get(mReadline, COMPLETION_PROC);
+ proc = rb_attr_get(mReadline, completion_proc);
if (NIL_P(proc))
return NULL;
rl_attempted_completion_over = 1;
- case_fold = RTEST(rb_iv_get(mReadline, COMPLETION_CASE_FOLD));
+ case_fold = RTEST(rb_attr_get(mReadline, completion_case_fold));
ary = rb_funcall(proc, rb_intern("call"), 1, rb_tainted_str_new2(text));
if (TYPE(ary) != T_ARRAY)
ary = rb_Array(ary);
@@ -697,6 +698,9 @@ Init_readline()
using_history();
+ completion_proc = rb_intern(COMPLETION_PROC);
+ completion_case_fold = rb_intern(COMPLETION_CASE_FOLD);
+
mReadline = rb_define_module("Readline");
rb_define_module_function(mReadline, "readline",
readline_readline, -1);