summaryrefslogtreecommitdiff
path: root/ext/readline
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-10 01:41:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-10 01:41:15 +0000
commit9fa668f34aa13367a9adc9903de9a8a782cf2910 (patch)
tree4bc408125fd68fff063f442bc44b9c4ddf9e1f40 /ext/readline
parent71935466b7d42eb883c76c472f07913dd85e550e (diff)
* ext/readline/readline.c (readline_attempted_completion_function):
empty completion result does not mean memory error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/readline.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index fa164ae..c3c23e4 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -667,10 +667,10 @@ readline_attempted_completion_function(const char *text, int start, int end)
#endif
case_fold = RTEST(rb_attr_get(mReadline, completion_case_fold));
ary = rb_funcall(proc, rb_intern("call"), 1, rb_locale_str_new_cstr(text));
- if (TYPE(ary) != T_ARRAY)
+ if (!RB_TYPE_P(ary, T_ARRAY)) {
ary = rb_Array(ary);
matches = RARRAY_LEN(ary);
- if (matches == NULL) rb_memerror();
+ if (matches == 0) return NULL;
result = (char**)malloc((matches + 2)*sizeof(char*));
if (result == NULL) rb_raise(rb_eNoMemError, "failed to allocate memory");
for (i = 0; i < matches; i++) {