int i9e_extract_completions(const char *word, char **string_list,
char ***result)
{
- char **matches = para_malloc(sizeof(char *));
+ char **matches = alloc(sizeof(char *));
int match_count = 0, matches_len = 1;
char **p;
int len = strlen(word);
match_count++;
if (match_count >= matches_len) {
matches_len *= 2;
- matches = para_realloc(matches,
- matches_len * sizeof(char *));
+ matches = arr_realloc(matches, matches_len,
+ sizeof(char *));
}
matches[match_count - 1] = para_strdup(*p);
}
if (is_prefix(word, cmd, len))
match_count++;
}
- matches = para_malloc((match_count + 1) * sizeof(*matches));
+ matches = arr_alloc(match_count + 1, sizeof(*matches));
for (i = 0, match_count = 0; (cmd = completers[i].name); i++)
if (is_prefix(word, cmd, len))
matches[match_count++] = para_strdup(cmd);
if (*p == ' ')
p++;
n = end - p + 1;
- ci.word = para_malloc(n + 1);
+ ci.word = alloc(n + 1);
strncpy(ci.word, p, n);
ci.word[n] = '\0';
create_matches: