aboutsummaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-04-21 19:43:01 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-24 10:31:31 -0300
commit244ca83be50ae0a4d3b25cadc4a28a3a57768a99 (patch)
tree0539b29364b9e9f2b19bc2655c3d3cf1ddfbee72 /src/quickfix.c
parente76d146029b988fe6f6eeb5df9d2c4328c07e3c0 (diff)
downloadrneovim-244ca83be50ae0a4d3b25cadc4a28a3a57768a99.tar.gz
rneovim-244ca83be50ae0a4d3b25cadc4a28a3a57768a99.tar.bz2
rneovim-244ca83be50ae0a4d3b25cadc4a28a3a57768a99.zip
No OOM error conditions in quickfix.c and regex_nfa.c
quickfix.c - ll_new_list - ll_get_or_alloc_list regex_nfa.c - realloc_post_list -> EMIT -> nfa_emit_equi_class - nfa_regcomp_start Use xrealloc() in realloc_post_list() (regexp_nfa.c) Test plan: force a call to realloc_post_list() for every use of the EMIT macro; open nvim and test regexp search.
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 6bc959db5c..f14861f5d9 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -200,8 +200,6 @@ qf_init (
if (wp != NULL) {
qi = ll_get_or_alloc_list(wp);
- if (qi == NULL)
- return FAIL;
}
return qf_init_ext(qi, efile, curbuf, NULL, errorformat, newlist,
@@ -977,10 +975,7 @@ qf_add_entry (
*/
static qf_info_T *ll_new_list(void)
{
- qf_info_T *qi;
-
- qi = (qf_info_T *)alloc((unsigned)sizeof(qf_info_T));
- memset(qi, 0, (size_t)(sizeof(qf_info_T)));
+ qf_info_T *qi = xcalloc(1, sizeof(qf_info_T));
qi->qf_refcount++;
return qi;
@@ -1030,8 +1025,7 @@ void copy_loclist(win_T *from, win_T *to)
return;
/* allocate a new location list */
- if ((to->w_llist = ll_new_list()) == NULL)
- return;
+ to->w_llist = ll_new_list();
to->w_llist->qf_listcount = qi->qf_listcount;
@@ -2797,8 +2791,6 @@ void ex_vimgrep(exarg_T *eap)
|| eap->cmdidx == CMD_lgrepadd
|| eap->cmdidx == CMD_lvimgrepadd) {
qi = ll_get_or_alloc_list(curwin);
- if (qi == NULL)
- return;
}
if (eap->addr_count > 0)
@@ -3339,8 +3331,6 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title)
if (wp != NULL) {
qi = ll_get_or_alloc_list(wp);
- if (qi == NULL)
- return FAIL;
}
if (action == ' ' || qi->qf_curlist == qi->qf_listcount)
@@ -3442,8 +3432,6 @@ void ex_cbuffer(exarg_T *eap)
if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer
|| eap->cmdidx == CMD_laddbuffer) {
qi = ll_get_or_alloc_list(curwin);
- if (qi == NULL)
- return;
}
if (*eap->arg == NUL)
@@ -3495,8 +3483,6 @@ void ex_cexpr(exarg_T *eap)
if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_lgetexpr
|| eap->cmdidx == CMD_laddexpr) {
qi = ll_get_or_alloc_list(curwin);
- if (qi == NULL)
- return;
}
/* Evaluate the expression. When the result is a string or a list we can
@@ -3570,8 +3556,7 @@ void ex_helpgrep(exarg_T *eap)
if (qi == NULL) {
/* Allocate a new location list for help text matches */
- if ((qi = ll_new_list()) == NULL)
- return;
+ qi = ll_new_list();
new_qi = TRUE;
}
}