list_unlet_range(
	list_T	    *l,
	listitem_T  *li_first,
	char_u	    *name,
	long	    n1_arg,
	int	    has_n2,
	long	    n2)
{
    listitem_T  *li = li_first;
    int		n1 = n1_arg;

    while (li != NULL && (!has_n2 || n2 >= n1))
    {
	if (value_check_lock(li->li_tv.v_lock, name, FALSE))
	    return FAIL;
	li = li->li_next;
	++n1;
    }

    // Delete a range of List items.
    li = li_first;
    n1 = n1_arg;
    while (li != NULL && (!has_n2 || n2 >= n1))
    {
	listitem_T *next = li->li_next;

	listitem_remove(l, li);
	li = next;
	++n1;
    }
    return OK;
}
list_unlet_range(
	list_T	    *l,
	listitem_T  *li_first,
	char_u	    *name,
	long	    n1_arg,
	int	    has_n2,
	long	    n2)
{
    listitem_T  *li = li_first;
    int		n1 = n1_arg;

    while (li != NULL && (!has_n2 || n2 >= n1))
    {
	if (value_check_lock(li->li_tv.v_lock, name, FALSE))
	    return FAIL;
	li = li->li_next;
	++n1;
    }

     
    li = li_first;
    n1 = n1_arg;
    while (li != NULL && (!has_n2 || n2 >= n1))
    {
	listitem_T *next = li->li_next;

	listitem_remove(l, li);
	li = next;
	++n1;
    }
    return OK;
}