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 | |
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.
-rw-r--r-- | src/misc2.c | 36 | ||||
-rw-r--r-- | src/option.c | 13 |
2 files changed, 5 insertions, 44 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 diff --git a/src/option.c b/src/option.c index 1bbd331816..72c3f2b7d0 100644 --- a/src/option.c +++ b/src/option.c @@ -2024,25 +2024,20 @@ void set_init_1(void) */ opt_idx = findoption((char_u *)"maxmemtot"); if (opt_idx >= 0) { -#if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM) +#ifndef HAVE_TOTAL_MEM if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L) #endif { -#ifdef HAVE_AVAIL_MEM - /* Use amount of memory available at this moment. */ - n = (mch_avail_mem(FALSE) >> 1); -#else -# ifdef HAVE_TOTAL_MEM +#ifdef HAVE_TOTAL_MEM /* Use amount of memory available to Vim. */ n = (mch_total_mem(FALSE) >> 1); -# else +#else n = (0x7fffffff >> 11); -# endif #endif options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n; opt_idx = findoption((char_u *)"maxmem"); if (opt_idx >= 0) { -#if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM) +#ifndef HAVE_TOTAL_MEM if ((long)options[opt_idx].def_val[VI_DEFAULT] > (long)n || (long)options[opt_idx].def_val[VI_DEFAULT] == 0L) #endif |