mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 16:36:30 +00:00
Remove OOM error handling code after ga_grow() calls
This commit is contained in:

committed by
Thiago de Arruda

parent
457bb26151
commit
f6b0e335e1
@@ -1,4 +1,4 @@
|
||||
/* vi:set ts=8 sts=4 sw=4:
|
||||
/* vi:set ts=2 sts=2 sw=2:
|
||||
*
|
||||
* VIM - Vi IMproved by Bram Moolenaar
|
||||
*
|
||||
@@ -1807,8 +1807,7 @@ getexmodeline (
|
||||
*/
|
||||
got_int = FALSE;
|
||||
while (!got_int) {
|
||||
if (ga_grow(&line_ga, 40) == FAIL)
|
||||
break;
|
||||
ga_grow(&line_ga, 40);
|
||||
|
||||
/* Get one character at a time. Don't use inchar(), it can't handle
|
||||
* special characters. */
|
||||
@@ -3999,9 +3998,8 @@ expand_shellcmd (
|
||||
/* Expand matches in one directory of $PATH. */
|
||||
ret = expand_wildcards(1, &buf, num_file, file, flags);
|
||||
if (ret == OK) {
|
||||
if (ga_grow(&ga, *num_file) == FAIL)
|
||||
FreeWild(*num_file, *file);
|
||||
else {
|
||||
ga_grow(&ga, *num_file);
|
||||
{
|
||||
for (i = 0; i < *num_file; ++i) {
|
||||
s = (*file)[i];
|
||||
if (STRLEN(s) > l) {
|
||||
@@ -4111,8 +4109,7 @@ static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ga_grow(&ga, 1) == FAIL)
|
||||
break;
|
||||
ga_grow(&ga, 1);
|
||||
|
||||
((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, (int)(e - s));
|
||||
++ga.ga_len;
|
||||
@@ -4146,8 +4143,7 @@ static int ExpandUserList(expand_T *xp, int *num_file, char_u ***file)
|
||||
if (li->li_tv.v_type != VAR_STRING || li->li_tv.vval.v_string == NULL)
|
||||
continue; /* Skip non-string items and empty strings */
|
||||
|
||||
if (ga_grow(&ga, 1) == FAIL)
|
||||
break;
|
||||
ga_grow(&ga, 1);
|
||||
|
||||
((char_u **)ga.ga_data)[ga.ga_len] =
|
||||
vim_strsave(li->li_tv.vval.v_string);
|
||||
@@ -4195,8 +4191,7 @@ static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file, char *dirname
|
||||
e = vim_strchr(s, '\n');
|
||||
if (e == NULL)
|
||||
e = s + STRLEN(s);
|
||||
if (ga_grow(&ga, 1) == FAIL)
|
||||
break;
|
||||
ga_grow(&ga, 1);
|
||||
if (e - 4 > s && STRNICMP(e - 4, ".vim", 4) == 0) {
|
||||
for (s = e - 4; s > matches; mb_ptr_back(matches, s))
|
||||
if (*s == '\n' || vim_ispathsep(*s))
|
||||
@@ -4263,15 +4258,15 @@ char_u *globpath(char_u *path, char_u *file, int expand_options)
|
||||
len += (int)STRLEN(p[i]) + 1;
|
||||
|
||||
/* Concatenate new results to previous ones. */
|
||||
if (ga_grow(&ga, len) == OK) {
|
||||
cur = (char_u *)ga.ga_data + ga.ga_len;
|
||||
for (i = 0; i < num_p; ++i) {
|
||||
STRCPY(cur, p[i]);
|
||||
cur += STRLEN(p[i]);
|
||||
*cur++ = '\n';
|
||||
}
|
||||
ga.ga_len += len;
|
||||
ga_grow(&ga, len);
|
||||
cur = (char_u *)ga.ga_data + ga.ga_len;
|
||||
for (i = 0; i < num_p; ++i) {
|
||||
STRCPY(cur, p[i]);
|
||||
cur += STRLEN(p[i]);
|
||||
*cur++ = '\n';
|
||||
}
|
||||
ga.ga_len += len;
|
||||
|
||||
FreeWild(num_p, p);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user