The refactoring of vim_getenv() to remove the mustfree arg
included reworking calling functions. expand_shellcmd was
also using that to track its usage of the variable within
the function, resulting in #2487. This change addresses
that scenario and cleans up some of the function for style.
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>
Problem : Dead assignment @ 2480.
Diagnostic : Harmless issue.
Rationale : It's true `reg` is not used any more after that point.
Resolution : Delete line.
- When not running the unit tests, building the third-party busted,
nvim-client and other dependencies can be skipped by passing
-DUSE_BUNDLED_BUSTED=FALSE to the third-party project.
Without the casts*, the compiler rightly warns about the os_getenv
losing the qualifier. This refactor adds a variable to manage this
properly, and renames the original variables to increase clarity.
This variable isn't stateful, and should be passed around instead.
Helped-By: Scott Prager <splinterofchaos@gmail.com>
Helped-By: Michael Reed <m.reed@mykolab.com>
This spares some work and also prevents list_join() from calling ga_init()
with a growsize of 0 which would lead to the nvimlog being littered with:
[warning @ ga_set_growsize:64] 17675 - trying to set an invalid ga_growsize: 0
Also in Vim 7.4.702
5216f767d4
This directory contains old (at least 10+ years) scripts that mainly filter
output of other old programs to make them conformant with an 'errorformat'
from 10+ years ago.
Implement functions for spawning, destroying, and listing active
servers, and add server_address_list() to msgpack_rpc/server.c for the
serverlist() vimL function.
Testing of server_start() and server_stop() found that after adding a
server at address addr, pmap_has(addr) would always return true, but
pmap_get(addr) would always return NULL.
Since a client is only expected to have a small number of servers, an
array may be more efficient than a hash map, anyway.
Discussion:
https://github.com/neovim/neovim/pull/1302#issuecomment-88487148