diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-03-26 17:08:47 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-26 18:29:17 -0300 |
commit | 580ababcb5b822aaf938defa38a0ffd5511f0d65 (patch) | |
tree | 86aac7cbaa8849b9917753d1a4ff3b58d00a20e6 /src/misc2.c | |
parent | 83161200c473293b2d8d69e3ee1899c6a7199e38 (diff) | |
download | rneovim-580ababcb5b822aaf938defa38a0ffd5511f0d65.tar.gz rneovim-580ababcb5b822aaf938defa38a0ffd5511f0d65.tar.bz2 rneovim-580ababcb5b822aaf938defa38a0ffd5511f0d65.zip |
HAVE_AVAIL_MEM is always undefined. Remove tests and dead code
Defining HAVE_AVAIL_MEM doesn't even build. The code tries to call
`mch_avail_mem` which is not defined.
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/src/misc2.c b/src/misc2.c index e8bb0c6522..154b610b13 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -599,13 +599,6 @@ int leftcol_changed(void) */ /* - * Some memory is reserved for error messages and for being able to - * call mf_release_all(), which needs some memory for mf_trans_add(). - */ -# define KEEP_ROOM (2 * 8192L) -#define KEEP_ROOM_KB (KEEP_ROOM / 1024L) - -/* * Note: if unsigned is 16 bits we can only allocate up to 64K with alloc(). * Use lalloc for larger blocks. */ @@ -665,9 +658,6 @@ char_u *lalloc(long_u size, int message) char_u *p; /* pointer to new storage space */ static int releasing = FALSE; /* don't do mf_release_all() recursive */ int try_again; -#if defined(HAVE_AVAIL_MEM) && !defined(SMALL_MEM) - static long_u allocated = 0; /* allocated since last avail check */ -#endif /* Safety check for allocating zero bytes */ if (size == 0) { @@ -682,33 +672,9 @@ char_u *lalloc(long_u size, int message) * if some blocks are released call malloc again. */ for (;; ) { - /* - * Handle three kind of systems: - * 1. No check for available memory: Just return. - * 2. Slow check for available memory: call mch_avail_mem() after - * allocating KEEP_ROOM amount of memory. - * 3. Strict check for available memory: call mch_avail_mem() - */ if ((p = (char_u *)malloc((size_t)size)) != NULL) { -#ifndef HAVE_AVAIL_MEM - /* 1. No check for available memory: Just return. */ + /* No check for available memory: Just return. */ goto theend; -#else -# ifndef SMALL_MEM - /* 2. Slow check for available memory: call mch_avail_mem() after - * allocating (KEEP_ROOM / 2) amount of memory. */ - allocated += size; - if (allocated < KEEP_ROOM / 2) - goto theend; - allocated = 0; -# endif - /* 3. check for available memory: call mch_avail_mem() */ - if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing) { - free((char *)p); /* System is low... no go! */ - p = NULL; - } else - goto theend; -#endif } /* * Remember that mf_release_all() is being called to avoid an endless |