Björn Linse wrote:
> > OK, yes, in that case it is different from a real empty list.
> > Do we really case about that?
>
> Anyway, the fix is simple:
>
> --- a/eval.c
> +++ b/eval.c
> @@ -10096,9 +10096,10 @@ static void f_getreg(typval_T *argvars, typval_T
> *rettv)
> rettv->v_type = VAR_LIST;
> rettv->vval.v_list =
> get_reg_contents(regname, (arg2 ? kGRegExprSrc : 0) | kGRegList);
> - if (rettv->vval.v_list != NULL) {
> - rettv->vval.v_list->lv_refcount++;
> + if (rettv->vval.v_list == NULL) {
> + rettv->vval.v_list = list_alloc();
> }
> + rettv->vval.v_list->lv_refcount++;
> } else {
>
> (well, patch from neovim, but vim is the same except indention and brackets)
Well, except that list_alloc() might return NULL.
I suppose it's better to make this easy to use than to save one
allocation once in a while. We'll have to make it consistent though.
--
ARTHUR: Well, it doesn't matter. Will you go and tell your master that
Arthur from the Court of Camelot is here.
GUARD #1: Listen, in order to maintain air-speed velocity, a swallow
needs to beat its wings 43 times every second, right?
ARTHUR: Please!
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.