Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix readline
  • Loading branch information
funny-falcon committed Jan 8, 2012
commit ecd6b98dfb8ed1bf69f988409321f34281b97ca6
6 changes: 3 additions & 3 deletions ext/readline/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,10 @@ readline_attempted_completion_function(const char *text, int start, int end)
matches = RARRAY_LEN(ary);
if (matches == 0)
return NULL;
result = ALLOC_N(char *, matches + 2);
result = (char**)malloc((matches + 2)*sizeof(char*));
for (i = 0; i < matches; i++) {
temp = rb_obj_as_string(RARRAY_PTR(ary)[i]);
result[i + 1] = ALLOC_N(char, RSTRING_LEN(temp) + 1);
result[i + 1] = (char*)malloc(RSTRING_LEN(temp) + 1);
strcpy(result[i + 1], RSTRING_PTR(temp));
}
result[matches + 1] = NULL;
Expand Down Expand Up @@ -707,7 +707,7 @@ readline_attempted_completion_function(const char *text, int start, int end)
if (low > si) low = si;
i++;
}
result[0] = ALLOC_N(char, low + 1);
result[0] = (char*)malloc(low + 1);
strncpy(result[0], result[1], low);
result[0][low] = '\0';
}
Expand Down