aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2015-04-21 16:56:12 +0200
committerEliseo Martínez <eliseomarmol@gmail.com>2015-04-23 16:26:44 +0200
commitc22b6124e284cf236298c57e700c5b57261c2c6d (patch)
tree7971f24c7509d7ca78d61bf8f0b0821606890b19 /src/nvim/regexp.c
parent178e9fc2f6c8e9d7c7858a71c05a3f896fc05eb2 (diff)
downloadrneovim-c22b6124e284cf236298c57e700c5b57261c2c6d.tar.gz
rneovim-c22b6124e284cf236298c57e700c5b57261c2c6d.tar.bz2
rneovim-c22b6124e284cf236298c57e700c5b57261c2c6d.zip
Fix warnings: ex_getln.c: init_history(): NP dereference: FP.
Problem : Dereference of null pointer @ 4199. Diagnostic : False positive. Rationale : Suggested error path implies that newlen == 0 and newlen > hislen, which implies hislen < 0, which is impossible (hislen is always between 0 and 10000). Resolution : Refactor code. Asserting oldlen >= 0 should have sufficed, but for some reason analyzer doesn't follow implications in that case. Asserting newlen != 0 || newlen <= hislen works. But the chance has been taken to do extensive refactoring of this function, as it was difficult to understand as it was. As a result of refactoring, assert is not needed anymore, as we don't call clear_hist_entry() in refactored version. Refactor : - Rework algorithm: * Drop guard for OOM case, which can't happen now. * Drop empty/growing/shrinking cases. Simplify to always doing the same. * Perform circular array reordering in all cases (before, it only did when shrinking). * Work in batches through memcpy/memset, instead of one entry at a time, as it did before. - Inline variable declarations. - Replace `ssize_t` by `int`. - Introduce oldlen as entry value of hislen. - Add a lot of comments. Helped-by: Scott Prager <splinterofchaos@gmail.com> Helped-by: oni-link <knil.ino@gmail.com>
Diffstat (limited to 'src/nvim/regexp.c')
0 files changed, 0 insertions, 0 deletions