1
0
forked from aniani/vim

patch 7.4.1058

Problem:    It is not possible to test code that is only reached when memory
            allocation fails.
Solution:   Add the alloc_fail() function.  Try it out with :vimgrep.
This commit is contained in:
Bram Moolenaar
2016-01-07 21:25:08 +01:00
parent 2b7db933b0
commit 75bdf6aa30
8 changed files with 138 additions and 5 deletions

View File

@@ -253,9 +253,9 @@ qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast,
{'s', ".\\+"}
};
namebuf = alloc(CMDBUFFSIZE + 1);
errmsg = alloc(CMDBUFFSIZE + 1);
pattern = alloc(CMDBUFFSIZE + 1);
namebuf = alloc_id(CMDBUFFSIZE + 1, 3);
errmsg = alloc_id(CMDBUFFSIZE + 1, 4);
pattern = alloc_id(CMDBUFFSIZE + 1, 5);
if (namebuf == NULL || errmsg == NULL || pattern == NULL)
goto qf_init_end;
@@ -3465,8 +3465,8 @@ ex_vimgrep(eap)
goto theend;
}
dirname_start = alloc(MAXPATHL);
dirname_now = alloc(MAXPATHL);
dirname_start = alloc_id(MAXPATHL, 1);
dirname_now = alloc_id(MAXPATHL, 2);
if (dirname_start == NULL || dirname_now == NULL)
goto theend;