aboutsummaryrefslogtreecommitdiff
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-04-07 22:28:33 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-11 12:57:59 -0300
commitf6b0e335e1f638e3c2d97e6886976d28d3798c32 (patch)
treec44159f894a036baa9e880f53cf3a2c3ba36adb7 /src/ex_getln.c
parent457bb2615154946d273d75e07f5d5a936f50ede0 (diff)
downloadrneovim-f6b0e335e1f638e3c2d97e6886976d28d3798c32.tar.gz
rneovim-f6b0e335e1f638e3c2d97e6886976d28d3798c32.tar.bz2
rneovim-f6b0e335e1f638e3c2d97e6886976d28d3798c32.zip
Remove OOM error handling code after ga_grow() calls
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 0cf9ff2dd8..f9332f1b31 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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);
}
}