Mercurial > vim
diff src/globals.h @ 7513:37e061ec063c v7.4.1058
commit https://github.com/vim/vim/commit/75bdf6aa30a5c99d67c42886cf7a4a000bbaa422
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 7 21:25:08 2016 +0100
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 07 Jan 2016 21:30:05 +0100 |
parents | 1886f2863437 |
children | 4c922651fd78 |
line wrap: on
line diff
--- a/src/globals.h +++ b/src/globals.h @@ -1619,6 +1619,15 @@ EXTERN FILE *time_fd INIT(= NULL); /* w EXTERN int ignored; EXTERN char *ignoredp; +#ifdef FEAT_EVAL +/* set by alloc_fail(): ID */ +EXTERN int alloc_fail_id INIT(= 0); +/* set by alloc_fail(), when zero alloc() returns NULL */ +EXTERN int alloc_fail_countdown INIT(= -1); +/* set by alloc_fail(), number of times alloc() returns NULL */ +EXTERN int alloc_fail_repeat INIT(= 0); +#endif + /* * Optional Farsi support. Include it here, so EXTERN and INIT are defined. */