Hi Bram,

On Wed, Oct 3, 2018 at 1:23 PM Bram Moolenaar <[email protected]> wrote:
>
> Yegappan wrote:
>
> > The quickfix code currently checks whether a quickfix/location
> > stack is empty by using the qf_listcount variable.
> > The attached patch replaces these checks by using a helper
> > function.
>
> It does change the logic, is this correct?  E.g.:
>
> -    if (qi == NULL || (qi->qf_listcount == 0
> -                               && qf_list_empty(qi, qi->qf_curlist)))
> +    if (qf_stack_empty(qi) || qf_list_empty(qi, qi->qf_curlist))
>
> This changes && into ||.
>

No. If qf_listcount is zero, then the stack is empty. In this case, there is
no need to check whether the list in the stack is empty or not. So this
change fixes a bug.

>
> And this:
>
> -    if (action == ' ' || qi->qf_curlist == qi->qf_listcount)
> +    if (action == ' ' || qf_stack_empty(qi))
>
> Was comparing qf_listcount with qf_curlist, now it compares with zero.
>

The current list index (qf_curlist) of a stack should always be less
than qf_listcount. It will be equal only when the stack is empty.
So both the checks are the same.

Regards,
Yegappan

-- 
-- 
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.

Raspunde prin e-mail lui