|
Karsten Hopp |
6d8149 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
6d8149 |
Subject: Patch 7.3.577
|
|
Karsten Hopp |
6d8149 |
Fcc: outbox
|
|
Karsten Hopp |
6d8149 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
6d8149 |
Mime-Version: 1.0
|
|
Karsten Hopp |
6d8149 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
6d8149 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
6d8149 |
------------
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
Patch 7.3.577
|
|
Karsten Hopp |
6d8149 |
Problem: Size of memory does not fit in 32 bit unsigned.
|
|
Karsten Hopp |
6d8149 |
Solution: Use Kbyte instead of byte. Call GlobalMemoryStatusEx() instead of
|
|
Karsten Hopp |
6d8149 |
GlobalMemoryStatus() when available.
|
|
Karsten Hopp |
6d8149 |
Files: src/misc2.c, src/option.c, src/os_amiga.c, src/os_msdos.c,
|
|
Karsten Hopp |
6d8149 |
src/os_win16.c, src/os_win32.c
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
*** ../vim-7.3.576/src/misc2.c 2012-02-29 13:58:43.000000000 +0100
|
|
Karsten Hopp |
6d8149 |
--- src/misc2.c 2012-06-29 15:30:54.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 815,820 ****
|
|
Karsten Hopp |
6d8149 |
--- 815,821 ----
|
|
Karsten Hopp |
6d8149 |
#else
|
|
Karsten Hopp |
6d8149 |
# define KEEP_ROOM (2 * 8192L)
|
|
Karsten Hopp |
6d8149 |
#endif
|
|
Karsten Hopp |
6d8149 |
+ #define KEEP_ROOM_KB (KEEP_ROOM / 1024L)
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/*
|
|
Karsten Hopp |
6d8149 |
* Note: if unsigned is 16 bits we can only allocate up to 64K with alloc().
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 940,946 ****
|
|
Karsten Hopp |
6d8149 |
allocated = 0;
|
|
Karsten Hopp |
6d8149 |
# endif
|
|
Karsten Hopp |
6d8149 |
/* 3. check for available memory: call mch_avail_mem() */
|
|
Karsten Hopp |
6d8149 |
! if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
free((char *)p); /* System is low... no go! */
|
|
Karsten Hopp |
6d8149 |
p = NULL;
|
|
Karsten Hopp |
6d8149 |
--- 941,947 ----
|
|
Karsten Hopp |
6d8149 |
allocated = 0;
|
|
Karsten Hopp |
6d8149 |
# endif
|
|
Karsten Hopp |
6d8149 |
/* 3. check for available memory: call mch_avail_mem() */
|
|
Karsten Hopp |
6d8149 |
! if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
free((char *)p); /* System is low... no go! */
|
|
Karsten Hopp |
6d8149 |
p = NULL;
|
|
Karsten Hopp |
6d8149 |
*** ../vim-7.3.576/src/option.c 2012-03-28 19:58:34.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
--- src/option.c 2012-06-29 15:31:46.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 3154,3160 ****
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
#ifdef HAVE_AVAIL_MEM
|
|
Karsten Hopp |
6d8149 |
/* Use amount of memory available at this moment. */
|
|
Karsten Hopp |
6d8149 |
! n = (mch_avail_mem(FALSE) >> 11);
|
|
Karsten Hopp |
6d8149 |
#else
|
|
Karsten Hopp |
6d8149 |
# ifdef HAVE_TOTAL_MEM
|
|
Karsten Hopp |
6d8149 |
/* Use amount of memory available to Vim. */
|
|
Karsten Hopp |
6d8149 |
--- 3154,3160 ----
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
#ifdef HAVE_AVAIL_MEM
|
|
Karsten Hopp |
6d8149 |
/* Use amount of memory available at this moment. */
|
|
Karsten Hopp |
6d8149 |
! n = (mch_avail_mem(FALSE) >> 1);
|
|
Karsten Hopp |
6d8149 |
#else
|
|
Karsten Hopp |
6d8149 |
# ifdef HAVE_TOTAL_MEM
|
|
Karsten Hopp |
6d8149 |
/* Use amount of memory available to Vim. */
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 6702,6708 ****
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
for (s = *varp; *s;)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
! while(*s == ',' || *s == ' ')
|
|
Karsten Hopp |
6d8149 |
s++;
|
|
Karsten Hopp |
6d8149 |
if (!*s)
|
|
Karsten Hopp |
6d8149 |
break;
|
|
Karsten Hopp |
6d8149 |
--- 6702,6708 ----
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
for (s = *varp; *s;)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
! while (*s == ',' || *s == ' ')
|
|
Karsten Hopp |
6d8149 |
s++;
|
|
Karsten Hopp |
6d8149 |
if (!*s)
|
|
Karsten Hopp |
6d8149 |
break;
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 7391,7397 ****
|
|
Karsten Hopp |
6d8149 |
new_unnamed |= CLIP_UNNAMED;
|
|
Karsten Hopp |
6d8149 |
p += 7;
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
! else if (STRNCMP(p, "unnamedplus", 11) == 0
|
|
Karsten Hopp |
6d8149 |
&& (p[11] == ',' || p[11] == NUL))
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
new_unnamed |= CLIP_UNNAMED_PLUS;
|
|
Karsten Hopp |
6d8149 |
--- 7391,7397 ----
|
|
Karsten Hopp |
6d8149 |
new_unnamed |= CLIP_UNNAMED;
|
|
Karsten Hopp |
6d8149 |
p += 7;
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
! else if (STRNCMP(p, "unnamedplus", 11) == 0
|
|
Karsten Hopp |
6d8149 |
&& (p[11] == ',' || p[11] == NUL))
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
new_unnamed |= CLIP_UNNAMED_PLUS;
|
|
Karsten Hopp |
6d8149 |
*** ../vim-7.3.576/src/os_amiga.c 2011-10-20 18:24:16.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
--- src/os_amiga.c 2012-06-29 15:33:59.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 191,206 ****
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/*
|
|
Karsten Hopp |
6d8149 |
! * Return amount of memory still available.
|
|
Karsten Hopp |
6d8149 |
*/
|
|
Karsten Hopp |
6d8149 |
long_u
|
|
Karsten Hopp |
6d8149 |
mch_avail_mem(special)
|
|
Karsten Hopp |
6d8149 |
int special;
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
#ifdef __amigaos4__
|
|
Karsten Hopp |
6d8149 |
! return (long_u)AvailMem(MEMF_ANY);
|
|
Karsten Hopp |
6d8149 |
#else
|
|
Karsten Hopp |
6d8149 |
! return (long_u)AvailMem(special ? (long)MEMF_CHIP : (long)MEMF_ANY);
|
|
Karsten Hopp |
6d8149 |
#endif
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
--- 191,206 ----
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/*
|
|
Karsten Hopp |
6d8149 |
! * Return amount of memory still available in Kbyte.
|
|
Karsten Hopp |
6d8149 |
*/
|
|
Karsten Hopp |
6d8149 |
long_u
|
|
Karsten Hopp |
6d8149 |
mch_avail_mem(special)
|
|
Karsten Hopp |
6d8149 |
int special;
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
#ifdef __amigaos4__
|
|
Karsten Hopp |
6d8149 |
! return (long_u)AvailMem(MEMF_ANY) >> 10;
|
|
Karsten Hopp |
6d8149 |
#else
|
|
Karsten Hopp |
6d8149 |
! return (long_u)(AvailMem(special ? (long)MEMF_CHIP : (long)MEMF_ANY)) >> 10;
|
|
Karsten Hopp |
6d8149 |
#endif
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
*** ../vim-7.3.576/src/os_msdos.c 2011-06-19 01:14:22.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
--- src/os_msdos.c 2012-06-29 15:33:26.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 550,564 ****
|
|
Karsten Hopp |
6d8149 |
#endif
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/*
|
|
Karsten Hopp |
6d8149 |
! * Return amount of memory currently available.
|
|
Karsten Hopp |
6d8149 |
*/
|
|
Karsten Hopp |
6d8149 |
long_u
|
|
Karsten Hopp |
6d8149 |
mch_avail_mem(int special)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
#ifdef DJGPP
|
|
Karsten Hopp |
6d8149 |
! return _go32_dpmi_remaining_virtual_memory();
|
|
Karsten Hopp |
6d8149 |
#else
|
|
Karsten Hopp |
6d8149 |
! return coreleft();
|
|
Karsten Hopp |
6d8149 |
#endif
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
--- 550,564 ----
|
|
Karsten Hopp |
6d8149 |
#endif
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/*
|
|
Karsten Hopp |
6d8149 |
! * Return amount of memory currently available in Kbyte.
|
|
Karsten Hopp |
6d8149 |
*/
|
|
Karsten Hopp |
6d8149 |
long_u
|
|
Karsten Hopp |
6d8149 |
mch_avail_mem(int special)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
#ifdef DJGPP
|
|
Karsten Hopp |
6d8149 |
! return _go32_dpmi_remaining_virtual_memory() >> 10;
|
|
Karsten Hopp |
6d8149 |
#else
|
|
Karsten Hopp |
6d8149 |
! return coreleft() >> 10;
|
|
Karsten Hopp |
6d8149 |
#endif
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
*** ../vim-7.3.576/src/os_win16.c 2011-10-20 18:24:16.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
--- src/os_win16.c 2012-06-29 15:34:18.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 379,391 ****
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/*
|
|
Karsten Hopp |
6d8149 |
! * How much memory is available?
|
|
Karsten Hopp |
6d8149 |
*/
|
|
Karsten Hopp |
6d8149 |
long_u
|
|
Karsten Hopp |
6d8149 |
mch_avail_mem(
|
|
Karsten Hopp |
6d8149 |
int special)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
! return GetFreeSpace(0);
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
--- 379,391 ----
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/*
|
|
Karsten Hopp |
6d8149 |
! * How much memory is available in Kbyte?
|
|
Karsten Hopp |
6d8149 |
*/
|
|
Karsten Hopp |
6d8149 |
long_u
|
|
Karsten Hopp |
6d8149 |
mch_avail_mem(
|
|
Karsten Hopp |
6d8149 |
int special)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
! return GetFreeSpace(0) >> 10;
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
*** ../vim-7.3.576/src/os_win32.c 2012-06-29 13:13:59.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
--- src/os_win32.c 2012-06-29 15:39:52.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 4992,5009 ****
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/*
|
|
Karsten Hopp |
6d8149 |
! * How much memory is available?
|
|
Karsten Hopp |
6d8149 |
* Return sum of available physical and page file memory.
|
|
Karsten Hopp |
6d8149 |
*/
|
|
Karsten Hopp |
6d8149 |
/*ARGSUSED*/
|
|
Karsten Hopp |
6d8149 |
long_u
|
|
Karsten Hopp |
6d8149 |
mch_avail_mem(int special)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
! MEMORYSTATUS ms;
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
! ms.dwLength = sizeof(MEMORYSTATUS);
|
|
Karsten Hopp |
6d8149 |
! GlobalMemoryStatus(&ms);
|
|
Karsten Hopp |
6d8149 |
! return (long_u) (ms.dwAvailPhys + ms.dwAvailPageFile);
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
6d8149 |
--- 4992,5020 ----
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/*
|
|
Karsten Hopp |
6d8149 |
! * How much memory is available in Kbyte?
|
|
Karsten Hopp |
6d8149 |
* Return sum of available physical and page file memory.
|
|
Karsten Hopp |
6d8149 |
*/
|
|
Karsten Hopp |
6d8149 |
/*ARGSUSED*/
|
|
Karsten Hopp |
6d8149 |
long_u
|
|
Karsten Hopp |
6d8149 |
mch_avail_mem(int special)
|
|
Karsten Hopp |
6d8149 |
{
|
|
Karsten Hopp |
6d8149 |
! if (g_PlatformId != VER_PLATFORM_WIN32_NT)
|
|
Karsten Hopp |
6d8149 |
! {
|
|
Karsten Hopp |
6d8149 |
! MEMORYSTATUS ms;
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
! ms.dwLength = sizeof(MEMORYSTATUS);
|
|
Karsten Hopp |
6d8149 |
! GlobalMemoryStatus(&ms);
|
|
Karsten Hopp |
6d8149 |
! return (long_u)((ms.dwAvailPhys + ms.dwAvailPageFile) >> 10);
|
|
Karsten Hopp |
6d8149 |
! }
|
|
Karsten Hopp |
6d8149 |
! else
|
|
Karsten Hopp |
6d8149 |
! {
|
|
Karsten Hopp |
6d8149 |
! MEMORYSTATUSEX ms;
|
|
Karsten Hopp |
6d8149 |
!
|
|
Karsten Hopp |
6d8149 |
! ms.dwLength = sizeof(MEMORYSTATUSEX);
|
|
Karsten Hopp |
6d8149 |
! GlobalMemoryStatusEx(&ms);
|
|
Karsten Hopp |
6d8149 |
! return (long_u)((ms.ullAvailPhys + ms.ullAvailPageFile) >> 10);
|
|
Karsten Hopp |
6d8149 |
! }
|
|
Karsten Hopp |
6d8149 |
}
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
6d8149 |
*** ../vim-7.3.576/src/version.c 2012-06-29 15:04:34.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
--- src/version.c 2012-06-29 15:45:44.000000000 +0200
|
|
Karsten Hopp |
6d8149 |
***************
|
|
Karsten Hopp |
6d8149 |
*** 716,717 ****
|
|
Karsten Hopp |
6d8149 |
--- 716,719 ----
|
|
Karsten Hopp |
6d8149 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
6d8149 |
+ /**/
|
|
Karsten Hopp |
6d8149 |
+ 577,
|
|
Karsten Hopp |
6d8149 |
/**/
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
--
|
|
Karsten Hopp |
6d8149 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
6d8149 |
75. You start wondering whether you could actually upgrade your brain
|
|
Karsten Hopp |
6d8149 |
with a Pentium Pro microprocessor 80. The upgrade works just fine.
|
|
Karsten Hopp |
6d8149 |
|
|
Karsten Hopp |
6d8149 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
6d8149 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
6d8149 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
6d8149 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|