]> granicus.if.org Git - vim/commitdiff
patch 8.0.1029: return value of getqflist() is inconsistent v8.0.1029
authorBram Moolenaar <Bram@vim.org>
Thu, 31 Aug 2017 18:58:02 +0000 (20:58 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 31 Aug 2017 18:58:02 +0000 (20:58 +0200)
Problem:    Return value of getqflist() is inconsistent.  (Lcd47)
Solution:   Always return an "items" entry.

src/quickfix.c
src/testdir/test_quickfix.vim
src/version.c

index 8277b937e9eccf9c379221a456bfc9ea3af04c55..1082fbd374f9f3e15b07e660288da74aef8bc0e6 100644 (file)
@@ -4653,6 +4653,11 @@ qf_get_list_from_text(dictitem_T *di, dict_T *retdict)
            || (di->di_tv.v_type == VAR_LIST
                && di->di_tv.vval.v_list != NULL))
     {
+       list_T  *l = list_alloc();
+
+       if (l == NULL)
+           return FAIL;
+
        qi = (qf_info_T *)alloc((unsigned)sizeof(qf_info_T));
        if (qi != NULL)
        {
@@ -4662,17 +4667,13 @@ qf_get_list_from_text(dictitem_T *di, dict_T *retdict)
            if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, p_efm,
                        TRUE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0)
            {
-               list_T  *l = list_alloc();
-               if (l != NULL)
-               {
-                   (void)get_errorlist(qi, NULL, 0, l);
-                   dict_add_list(retdict, "items", l);
-                   status = OK;
-               }
+               (void)get_errorlist(qi, NULL, 0, l);
                qf_free(qi, 0);
            }
            free(qi);
        }
+       dict_add_list(retdict, "items", l);
+       status = OK;
     }
 
     return status;
index 076d583fd02df82d503efeccf8063d9c01dcd0e8..d6b65e339fd2a3e3e858913d05c2aced15b61631 100644 (file)
@@ -2536,7 +2536,7 @@ func XgetListFromText(cchar)
   call assert_equal(30, l[1].lnum)
 
   call assert_equal({}, g:Xgetlist({'text' : 10}))
-  call assert_equal({}, g:Xgetlist({'text' : []}))
+  call assert_equal([], g:Xgetlist({'text' : []}).items)
 
   " Make sure that the quickfix stack is not modified
   call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr)
index 37afc35012295f953f6aa5bf388282444548e9bb..fbf175efdb0e10b306814a335d44a241eb4d8c76 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1029,
 /**/
     1028,
 /**/