To: vim_dev@googlegroups.com Subject: Patch 8.0.1029 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1029 Problem: Return value of getqflist() is inconsistent. (Lcd47) Solution: Always return an "items" entry. Files: src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.0.1028/src/quickfix.c 2017-08-30 20:33:51.758040889 +0200 --- src/quickfix.c 2017-08-31 20:57:31.618489833 +0200 *************** *** 4653,4658 **** --- 4653,4663 ---- || (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,4678 **** 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; ! } qf_free(qi, 0); } free(qi); } } return status; --- 4667,4679 ---- if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, p_efm, TRUE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) { ! (void)get_errorlist(qi, NULL, 0, l); qf_free(qi, 0); } free(qi); } + dict_add_list(retdict, "items", l); + status = OK; } return status; *** ../vim-8.0.1028/src/testdir/test_quickfix.vim 2017-08-30 20:33:51.758040889 +0200 --- src/testdir/test_quickfix.vim 2017-08-31 20:49:36.633680015 +0200 *************** *** 2536,2542 **** call assert_equal(30, l[1].lnum) call assert_equal({}, g:Xgetlist({'text' : 10})) ! call assert_equal({}, g:Xgetlist({'text' : []})) " Make sure that the quickfix stack is not modified call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr) --- 2536,2542 ---- call assert_equal(30, l[1].lnum) call assert_equal({}, g:Xgetlist({'text' : 10})) ! call assert_equal([], g:Xgetlist({'text' : []}).items) " Make sure that the quickfix stack is not modified call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr) *** ../vim-8.0.1028/src/version.c 2017-08-31 20:42:14.940643583 +0200 --- src/version.c 2017-08-31 20:51:19.464989381 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1029, /**/ -- Just remember...if the world didn't suck, we'd all fall off. /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///