summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/misc2.c3
-rw-r--r--src/option.c6
-rw-r--r--src/os_amiga.c6
-rw-r--r--src/os_msdos.c6
-rw-r--r--src/os_win16.c4
-rw-r--r--src/os_win32.c21
-rw-r--r--src/version.c2
7 files changed, 31 insertions, 17 deletions
diff --git a/src/misc2.c b/src/misc2.c
index d62c771cd..5d60954be 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -815,6 +815,7 @@ vim_mem_profile_dump()
#else
# define KEEP_ROOM (2 * 8192L)
#endif
+#define KEEP_ROOM_KB (KEEP_ROOM / 1024L)
/*
* Note: if unsigned is 16 bits we can only allocate up to 64K with alloc().
@@ -940,7 +941,7 @@ lalloc(size, message)
allocated = 0;
# endif
/* 3. check for available memory: call mch_avail_mem() */
- if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
+ if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing)
{
free((char *)p); /* System is low... no go! */
p = NULL;
diff --git a/src/option.c b/src/option.c
index 9acb270f1..308d7a81f 100644
--- a/src/option.c
+++ b/src/option.c
@@ -3154,7 +3154,7 @@ set_init_1()
{
#ifdef HAVE_AVAIL_MEM
/* Use amount of memory available at this moment. */
- n = (mch_avail_mem(FALSE) >> 11);
+ n = (mch_avail_mem(FALSE) >> 1);
#else
# ifdef HAVE_TOTAL_MEM
/* Use amount of memory available to Vim. */
@@ -6702,7 +6702,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
{
for (s = *varp; *s;)
{
- while(*s == ',' || *s == ' ')
+ while (*s == ',' || *s == ' ')
s++;
if (!*s)
break;
@@ -7391,7 +7391,7 @@ check_clipboard_option()
new_unnamed |= CLIP_UNNAMED;
p += 7;
}
- else if (STRNCMP(p, "unnamedplus", 11) == 0
+ else if (STRNCMP(p, "unnamedplus", 11) == 0
&& (p[11] == ',' || p[11] == NUL))
{
new_unnamed |= CLIP_UNNAMED_PLUS;
diff --git a/src/os_amiga.c b/src/os_amiga.c
index d84af4ce1..e2b157949 100644
--- a/src/os_amiga.c
+++ b/src/os_amiga.c
@@ -191,16 +191,16 @@ mch_char_avail()
}
/*
- * Return amount of memory still available.
+ * Return amount of memory still available in Kbyte.
*/
long_u
mch_avail_mem(special)
int special;
{
#ifdef __amigaos4__
- return (long_u)AvailMem(MEMF_ANY);
+ return (long_u)AvailMem(MEMF_ANY) >> 10;
#else
- return (long_u)AvailMem(special ? (long)MEMF_CHIP : (long)MEMF_ANY);
+ return (long_u)(AvailMem(special ? (long)MEMF_CHIP : (long)MEMF_ANY)) >> 10;
#endif
}
diff --git a/src/os_msdos.c b/src/os_msdos.c
index 3449d23b9..2d1cf73dd 100644
--- a/src/os_msdos.c
+++ b/src/os_msdos.c
@@ -550,15 +550,15 @@ mch_update_cursor(void)
#endif
/*
- * Return amount of memory currently available.
+ * Return amount of memory currently available in Kbyte.
*/
long_u
mch_avail_mem(int special)
{
#ifdef DJGPP
- return _go32_dpmi_remaining_virtual_memory();
+ return _go32_dpmi_remaining_virtual_memory() >> 10;
#else
- return coreleft();
+ return coreleft() >> 10;
#endif
}
diff --git a/src/os_win16.c b/src/os_win16.c
index 0be6c6316..b620149e7 100644
--- a/src/os_win16.c
+++ b/src/os_win16.c
@@ -379,13 +379,13 @@ mch_breakcheck()
/*
- * How much memory is available?
+ * How much memory is available in Kbyte?
*/
long_u
mch_avail_mem(
int special)
{
- return GetFreeSpace(0);
+ return GetFreeSpace(0) >> 10;
}
diff --git a/src/os_win32.c b/src/os_win32.c
index c0434dbda..af1232eab 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -4992,18 +4992,29 @@ mch_breakcheck(void)
/*
- * How much memory is available?
+ * How much memory is available in Kbyte?
* Return sum of available physical and page file memory.
*/
/*ARGSUSED*/
long_u
mch_avail_mem(int special)
{
- MEMORYSTATUS ms;
+ if (g_PlatformId != VER_PLATFORM_WIN32_NT)
+ {
+ MEMORYSTATUS ms;
+
+ ms.dwLength = sizeof(MEMORYSTATUS);
+ GlobalMemoryStatus(&ms);
+ return (long_u)((ms.dwAvailPhys + ms.dwAvailPageFile) >> 10);
+ }
+ else
+ {
+ MEMORYSTATUSEX ms;
- ms.dwLength = sizeof(MEMORYSTATUS);
- GlobalMemoryStatus(&ms);
- return (long_u) (ms.dwAvailPhys + ms.dwAvailPageFile);
+ ms.dwLength = sizeof(MEMORYSTATUSEX);
+ GlobalMemoryStatusEx(&ms);
+ return (long_u)((ms.ullAvailPhys + ms.ullAvailPageFile) >> 10);
+ }
}
#ifdef FEAT_MBYTE
diff --git a/src/version.c b/src/version.c
index 646d223bd..58bb4732c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 577,
+/**/
576,
/**/
575,