зеркало из https://github.com/github/ruby.git
* ext/readline/readline.c (readline_attempted_completion_function):
fix typos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b78bddee35
Коммит
41889c5adc
|
@ -1,3 +1,8 @@
|
|||
Mon Jan 9 23:37:43 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
|
||||
|
||||
* ext/readline/readline.c (readline_attempted_completion_function):
|
||||
fix typos.
|
||||
|
||||
Mon Jan 9 20:55:34 2012 Narihiro Nakamura <authornari@gmail.com>
|
||||
|
||||
* gc.c : don't embed struct heaps_slot to a heap block because it
|
||||
|
|
|
@ -670,13 +670,13 @@ readline_attempted_completion_function(const char *text, int start, int end)
|
|||
if (TYPE(ary) != T_ARRAY)
|
||||
ary = rb_Array(ary);
|
||||
matches = RARRAY_LEN(ary);
|
||||
if (matches == NULL) rb_mem_error();
|
||||
if (matches == NULL) rb_memerror();
|
||||
result = (char**)malloc((matches + 2)*sizeof(char*));
|
||||
if (result == NULL) rb_raise(rb_eNoMemError, "%s");
|
||||
if (result == NULL) rb_raise(rb_eNoMemError, "failed to allocate memory");
|
||||
for (i = 0; i < matches; i++) {
|
||||
temp = rb_obj_as_string(RARRAY_PTR(ary)[i]);
|
||||
result[i + 1] = (char*)malloc(RSTRING_LEN(temp) + 1);
|
||||
if (result[i + 1] == NULL) rb_mem_error();
|
||||
if (result[i + 1] == NULL) rb_memerror();
|
||||
strcpy(result[i + 1], RSTRING_PTR(temp));
|
||||
}
|
||||
result[matches + 1] = NULL;
|
||||
|
@ -709,7 +709,7 @@ readline_attempted_completion_function(const char *text, int start, int end)
|
|||
i++;
|
||||
}
|
||||
result[0] = (char*)malloc(low + 1);
|
||||
if (result[0] == NULL) rb_mem_error();
|
||||
if (result[0] == NULL) rb_memerror();
|
||||
strncpy(result[0], result[1], low);
|
||||
result[0][low] = '\0';
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче