mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/readline/readline.c (readline_attempted_completion_function):
use rb_memerror(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
931459d974
commit
b04814bf71
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Jan 10 15:13:58 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* ext/readline/readline.c (readline_attempted_completion_function):
|
||||
use rb_memerror().
|
||||
|
||||
Tue Jan 10 12:49:42 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* gc.c: in fact, i686-linux doesn't need to define _XOPEN_SOURCE 600.
|
||||
|
|
|
@ -672,7 +672,7 @@ readline_attempted_completion_function(const char *text, int start, int end)
|
|||
matches = RARRAY_LEN(ary);
|
||||
if (matches == 0) return NULL;
|
||||
result = (char**)malloc((matches + 2)*sizeof(char*));
|
||||
if (result == NULL) rb_raise(rb_eNoMemError, "failed to allocate memory");
|
||||
if (result == NULL) rb_memerror();
|
||||
for (i = 0; i < matches; i++) {
|
||||
temp = rb_obj_as_string(RARRAY_PTR(ary)[i]);
|
||||
result[i + 1] = (char*)malloc(RSTRING_LEN(temp) + 1);
|
||||
|
|
Loading…
Reference in a new issue