diff options
author | Jack Danger Canty <jackdanger@squareup.com> | 2015-01-18 19:10:25 -0800 |
---|---|---|
committer | Jack Danger Canty <jackdanger@squareup.com> | 2015-01-18 19:31:22 -0800 |
commit | f44a1e1632528536cb98b5618574eb3c2281cf17 (patch) | |
tree | dd9bdf96f87b257fc464f36dfbae408c55d02f46 /src | |
parent | c7f4e553629f9ac667dee1e920b96c7c327380f6 (diff) | |
download | rneovim-f44a1e1632528536cb98b5618574eb3c2281cf17.tar.gz rneovim-f44a1e1632528536cb98b5618574eb3c2281cf17.tar.bz2 rneovim-f44a1e1632528536cb98b5618574eb3c2281cf17.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/indent_c.c | 2 |
1 files changed, 1 insertions, 1 deletions
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 */ |