diff options
author | HiPhish <hiphish@Aleksandars-iMac.local> | 2016-04-26 18:10:36 +0200 |
---|---|---|
committer | HiPhish <hiphish@Aleksandars-iMac.local> | 2016-04-27 18:53:00 +0200 |
commit | f644d8d88e621ab11dcb831b3cee6c5ea1df24b2 (patch) | |
tree | 7c3f56f56512401015b5727b1335cd767f8ccb41 /runtime/syntax/php.vim | |
parent | 6bb4b9f57f5011db0c895370e00f2351422a2c25 (diff) | |
download | rneovim-f644d8d88e621ab11dcb831b3cee6c5ea1df24b2.tar.gz rneovim-f644d8d88e621ab11dcb831b3cee6c5ea1df24b2.tar.bz2 rneovim-f644d8d88e621ab11dcb831b3cee6c5ea1df24b2.zip |
Fix coverity errors in haslocaldir() and getcwd.
The Vim function `haslocaldir()` would crash if the users called it with
the two arguments `-1, -1`. Now it returns `0` in that case.
The coverity issue was complaining about a NULL dereference, but there
can never be a case where the pointer `tp` is NULL and being
dereferenced. An assertion has been put in place to satisfy coverity.
Furthermore the functions themselves have been cleaned up. First of all
the documentation comment for the different scopes has been extended and
a macro for the minimum scope has been introduced. In both functions any
time a scope is used as a range (e.g. in a loop) macros instead of
actuals scopes are used, that makes the functions more robust if new
scopes are added.
Second, in the implementation of `getcwd()` there was a superfluous
loop, it has been removed completely. I also changed all `goto end` to
plaing `return` statements by moving the allocation of `cwd` down, that
way there is no need for `goto` anymore.
Diffstat (limited to 'runtime/syntax/php.vim')
0 files changed, 0 insertions, 0 deletions