From f44a1e1632528536cb98b5618574eb3c2281cf17 Mon Sep 17 00:00:00 2001 From: Jack Danger Canty Date: Sun, 18 Jan 2015 19:10:25 -0800 Subject: [PATCH] coverity/102151: initialize `our_paren_pos` This hoists the initialization of `our_paren_pos` outside a conditional so it can be safely referenced further down in this function. Originally broken in: https://code.google.com/p/vim/source/diff?spec=svndc8197342755fda6ca4d6619dac228406867a7ce&old=01583c79d5f4d3f29d4c33dd10dd29efd349cad0&r=dc8197342755fda6ca4d6619dac228406867a7ce&format=unidiff&path=%2Fsrc%2Fmisc1.c This fixes CID #102151 https://scan8.coverity.com/reports.htm#v22612/p10672/fileInstanceId=3625174&defectInstanceId=1525719&mergedDefectId=102151 --- src/nvim/indent_c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 56276db3ce..9c636ebbcc 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -1805,6 +1805,7 @@ int get_c_indent(void) } if (trypos != NULL) { + our_paren_pos = *trypos; /* * If the matching paren is more than one line away, use the indent of * a previous non-empty line that matches the same paren. @@ -1814,7 +1815,6 @@ int get_c_indent(void) amount = get_indent_lnum(curwin->w_cursor.lnum - 1); /* XXX */ } else { amount = -1; - our_paren_pos = *trypos; for (lnum = cur_curpos.lnum - 1; lnum > our_paren_pos.lnum; --lnum) { l = skipwhite(ml_get(lnum)); if (cin_nocode(l)) /* skip comment lines */