mirror of
https://github.com/neovim/neovim.git
synced 2025-12-11 00:52:44 +00:00
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.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user