diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-11-09 13:31:51 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-11-09 13:31:51 -0500 |
commit | e9ac693bcde8e09e943b1e4a0e8a534c813501b8 (patch) | |
tree | 705cf381688eb92a157052404946e793c1aa4642 /src/nvim/regexp.c | |
parent | dcccc1a50de3caea62ab12f9e15fc6f3e242b5c4 (diff) | |
parent | 74817b546e6fd4c6ec6e201c1b461e6cfbf5a3be (diff) | |
download | rneovim-e9ac693bcde8e09e943b1e4a0e8a534c813501b8.tar.gz rneovim-e9ac693bcde8e09e943b1e4a0e8a534c813501b8.tar.bz2 rneovim-e9ac693bcde8e09e943b1e4a0e8a534c813501b8.zip |
Merge pull request #1389 from elmart/clang-analysis-fixes
Fix clang analysis warnings.
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 90da02bb1b..cef2e6d9bf 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -43,6 +43,7 @@ /* #undef REGEXP_DEBUG */ /* #define REGEXP_DEBUG */ +#include <assert.h> #include <inttypes.h> #include <stdbool.h> #include <string.h> @@ -1199,10 +1200,7 @@ char_u *skip_regexp(char_u *startp, int dirc, int magic, char_u **newp) *newp = vim_strsave(startp); p = *newp + (p - startp); } - if (*newp != NULL) - STRMOVE(p, p + 1); - else - ++p; + STRMOVE(p, p + 1); } else ++p; /* skip next character */ if (*p == 'v') @@ -1300,16 +1298,18 @@ static regprog_T *bt_regcomp(char_u *expr, int re_flags) r->regstart = (*mb_ptr2char)(OPERAND(scan)); else r->regstart = *OPERAND(scan); - } else if ((OP(scan) == BOW - || OP(scan) == EOW - || OP(scan) == NOTHING - || OP(scan) == MOPEN + 0 || OP(scan) == NOPEN - || OP(scan) == MCLOSE + 0 || OP(scan) == NCLOSE) - && OP(regnext(scan)) == EXACTLY) { - if (has_mbyte) - r->regstart = (*mb_ptr2char)(OPERAND(regnext(scan))); - else - r->regstart = *OPERAND(regnext(scan)); + } else if (OP(scan) == BOW + || OP(scan) == EOW + || OP(scan) == NOTHING + || OP(scan) == MOPEN + 0 || OP(scan) == NOPEN + || OP(scan) == MCLOSE + 0 || OP(scan) == NCLOSE) { + char_u *regnext_scan = regnext(scan); + if (OP(regnext_scan) == EXACTLY) { + if (has_mbyte) + r->regstart = (*mb_ptr2char)(OPERAND(regnext_scan)); + else + r->regstart = *OPERAND(regnext_scan); + } } /* @@ -5626,6 +5626,8 @@ static int match_with_backref(linenr_T start_lnum, colnr_T start_col, linenr_T e /* Get the line to compare with. */ p = reg_getline(clnum); + assert(p); + if (clnum == end_lnum) len = end_col - ccol; else |