diff options
author | ZyX <kp-pav@yandex.ru> | 2017-01-29 03:36:47 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-27 00:12:42 +0300 |
commit | 3d48c35d6bfa83ba3ae621fa9ec3f512da199f59 (patch) | |
tree | df801c433c2be1eb94aafefce914e24113b888fa /src/nvim/ex_docmd.c | |
parent | 3531d8c8eaa6783637f510dbc5dbd58c9d435b61 (diff) | |
download | rneovim-3d48c35d6bfa83ba3ae621fa9ec3f512da199f59.tar.gz rneovim-3d48c35d6bfa83ba3ae621fa9ec3f512da199f59.tar.bz2 rneovim-3d48c35d6bfa83ba3ae621fa9ec3f512da199f59.zip |
ex_getln: Refactor script_get()
1. Use `char *` for strings.
2. Add `const` qualifiers.
3. Add attributes and documentation.
4. Handle skipping *inside*.
5. Handle non-heredoc argument also inside: deferring this to the caller is
pointless because all callers need the same thing. Though new ex_lua caller
may live without allocations in this case, allocating nevertheless produces
cleaner code.
6. Note that all callers call script_get with `eap` and `eap->arg`. Thus second
argument is useless in practice: it is one and the same always and can be
reached through the first argument.
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index aa43b71a0d..74bb6177c6 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3734,10 +3734,12 @@ void ex_ni(exarg_T *eap) /// Skips over ":perl <<EOF" constructs. static void ex_script_ni(exarg_T *eap) { - if (!eap->skip) + if (!eap->skip) { ex_ni(eap); - else - xfree(script_get(eap, eap->arg)); + } else { + size_t len; + xfree(script_get(eap, &len)); + } } /* |