No OOM in ExpandGeneric()

This commit is contained in:
Felipe Oliveira Carvalho
2014-05-28 23:13:38 -03:00
parent ab016d3dbd
commit 0b849e775c

View File

@@ -3743,10 +3743,12 @@ ExpandFromContext (
ret = FAIL; ret = FAIL;
for (i = 0; i < (int)(sizeof(tab) / sizeof(struct expgen)); ++i) for (i = 0; i < (int)(sizeof(tab) / sizeof(struct expgen)); ++i)
if (xp->xp_context == tab[i].context) { if (xp->xp_context == tab[i].context) {
if (tab[i].ic) if (tab[i].ic) {
regmatch.rm_ic = TRUE; regmatch.rm_ic = TRUE;
ret = ExpandGeneric(xp, &regmatch, num_file, file, }
tab[i].func, tab[i].escaped); ExpandGeneric(xp, &regmatch, num_file, file, tab[i].func,
tab[i].escaped);
ret = OK;
break; break;
} }
} }
@@ -3762,10 +3764,8 @@ ExpandFromContext (
* Generic function for command line completion. It calls a function to * Generic function for command line completion. It calls a function to
* obtain strings, one by one. The strings are matched against a regexp * obtain strings, one by one. The strings are matched against a regexp
* program. Matching strings are copied into an array, which is returned. * program. Matching strings are copied into an array, which is returned.
*
* Returns OK when no problems encountered, FAIL for error.
*/ */
int ExpandGeneric( void ExpandGeneric(
expand_T *xp, expand_T *xp,
regmatch_T *regmatch, regmatch_T *regmatch,
int *num_file, int *num_file,
@@ -3790,7 +3790,7 @@ int ExpandGeneric(
} }
} }
if (count == 0) if (count == 0)
return OK; return;
*num_file = count; *num_file = count;
*file = (char_u **)xmalloc(count * sizeof(char_u *)); *file = (char_u **)xmalloc(count * sizeof(char_u *));
@@ -3832,8 +3832,6 @@ int ExpandGeneric(
/* Reset the variables used for special highlight names expansion, so that /* Reset the variables used for special highlight names expansion, so that
* they don't show up when getting normal highlight names by ID. */ * they don't show up when getting normal highlight names by ID. */
reset_expand_highlight(); reset_expand_highlight();
return OK;
} }
/* /*