diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-08-31 20:58:02 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-08-31 20:58:02 +0200 |
commit | da73253a0b908bad03ddcd625fe3fb32008efbf6 (patch) | |
tree | 7a66f88692e0727443d87f5158b0e36f753dd1db | |
parent | 3d593c2dc97c5426316bf343910cad911b2f6b49 (diff) |
patch 8.0.1029: return value of getqflist() is inconsistentv8.0.1029
Problem: Return value of getqflist() is inconsistent. (Lcd47)
Solution: Always return an "items" entry.
-rw-r--r-- | src/quickfix.c | 15 | ||||
-rw-r--r-- | src/testdir/test_quickfix.vim | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/quickfix.c b/src/quickfix.c index 8277b937e9..1082fbd374 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -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; diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 076d583fd0..d6b65e339f 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -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) diff --git a/src/version.c b/src/version.c index 37afc35012..fbf175efdb 100644 --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1029, +/**/ 1028, /**/ 1027, |