diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-28 23:13:38 -0300 |
---|---|---|
committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-06-16 01:31:37 -0300 |
commit | 0b849e775cd0a2be8e34109d265f21cd78138bc7 (patch) | |
tree | 70513d081c34a4266b0796c2504f4999cfd734ff | |
parent | ab016d3dbd97bfba0493f1ee083fe4690cb21b81 (diff) | |
download | rneovim-0b849e775cd0a2be8e34109d265f21cd78138bc7.tar.gz rneovim-0b849e775cd0a2be8e34109d265f21cd78138bc7.tar.bz2 rneovim-0b849e775cd0a2be8e34109d265f21cd78138bc7.zip |
No OOM in ExpandGeneric()
-rw-r--r-- | src/nvim/ex_getln.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 78f466f497..f2f00d3bd0 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -3743,10 +3743,12 @@ ExpandFromContext ( ret = FAIL; for (i = 0; i < (int)(sizeof(tab) / sizeof(struct expgen)); ++i) if (xp->xp_context == tab[i].context) { - if (tab[i].ic) + if (tab[i].ic) { regmatch.rm_ic = TRUE; - ret = ExpandGeneric(xp, ®match, num_file, file, - tab[i].func, tab[i].escaped); + } + ExpandGeneric(xp, ®match, num_file, file, tab[i].func, + tab[i].escaped); + ret = OK; break; } } @@ -3762,10 +3764,8 @@ ExpandFromContext ( * Generic function for command line completion. It calls a function to * obtain strings, one by one. The strings are matched against a regexp * 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, regmatch_T *regmatch, int *num_file, @@ -3790,7 +3790,7 @@ int ExpandGeneric( } } if (count == 0) - return OK; + return; *num_file = count; *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 * they don't show up when getting normal highlight names by ID. */ reset_expand_highlight(); - - return OK; } /* |