summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.3.577
blob: 2929b22d3b7e8ce35d3c44394405adfec5574fcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
To: vim_dev@googlegroups.com
Subject: Patch 7.3.577
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.577
Problem:    Size of memory does not fit in 32 bit unsigned.
Solution:   Use Kbyte instead of byte.  Call GlobalMemoryStatusEx() instead of
	    GlobalMemoryStatus() when available.
Files:	    src/misc2.c, src/option.c, src/os_amiga.c, src/os_msdos.c,
	    src/os_win16.c, src/os_win32.c


*** ../vim-7.3.576/src/misc2.c	2012-02-29 13:58:43.000000000 +0100
--- src/misc2.c	2012-06-29 15:30:54.000000000 +0200
***************
*** 815,820 ****
--- 815,821 ----
  #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,946 ****
  	    allocated = 0;
  # endif
  	    /* 3. check for available memory: call mch_avail_mem() */
! 	    if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
  	    {
  		free((char *)p);	/* System is low... no go! */
  		p = NULL;
--- 941,947 ----
  	    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;
*** ../vim-7.3.576/src/option.c	2012-03-28 19:58:34.000000000 +0200
--- src/option.c	2012-06-29 15:31:46.000000000 +0200
***************
*** 3154,3160 ****
  	{
  #ifdef HAVE_AVAIL_MEM
  	    /* Use amount of memory available at this moment. */
! 	    n = (mch_avail_mem(FALSE) >> 11);
  #else
  # ifdef HAVE_TOTAL_MEM
  	    /* Use amount of memory available to Vim. */
--- 3154,3160 ----
  	{
  #ifdef HAVE_AVAIL_MEM
  	    /* Use amount of memory available at this moment. */
! 	    n = (mch_avail_mem(FALSE) >> 1);
  #else
  # ifdef HAVE_TOTAL_MEM
  	    /* Use amount of memory available to Vim. */
***************
*** 6702,6708 ****
      {
  	for (s = *varp; *s;)
  	{
! 	    while(*s == ',' || *s == ' ')
  		s++;
  	    if (!*s)
  		break;
--- 6702,6708 ----
      {
  	for (s = *varp; *s;)
  	{
! 	    while (*s == ',' || *s == ' ')
  		s++;
  	    if (!*s)
  		break;
***************
*** 7391,7397 ****
  	    new_unnamed |= CLIP_UNNAMED;
  	    p += 7;
  	}
!         else if (STRNCMP(p, "unnamedplus", 11) == 0
  					    && (p[11] == ',' || p[11] == NUL))
  	{
  	    new_unnamed |= CLIP_UNNAMED_PLUS;
--- 7391,7397 ----
  	    new_unnamed |= CLIP_UNNAMED;
  	    p += 7;
  	}
! 	else if (STRNCMP(p, "unnamedplus", 11) == 0
  					    && (p[11] == ',' || p[11] == NUL))
  	{
  	    new_unnamed |= CLIP_UNNAMED_PLUS;
*** ../vim-7.3.576/src/os_amiga.c	2011-10-20 18:24:16.000000000 +0200
--- src/os_amiga.c	2012-06-29 15:33:59.000000000 +0200
***************
*** 191,206 ****
  }
  
  /*
!  * Return amount of memory still available.
   */
      long_u
  mch_avail_mem(special)
      int	    special;
  {
  #ifdef __amigaos4__
!     return (long_u)AvailMem(MEMF_ANY);
  #else
!     return (long_u)AvailMem(special ? (long)MEMF_CHIP : (long)MEMF_ANY);
  #endif
  }
  
--- 191,206 ----
  }
  
  /*
!  * Return amount of memory still available in Kbyte.
   */
      long_u
  mch_avail_mem(special)
      int	    special;
  {
  #ifdef __amigaos4__
!     return (long_u)AvailMem(MEMF_ANY) >> 10;
  #else
!     return (long_u)(AvailMem(special ? (long)MEMF_CHIP : (long)MEMF_ANY)) >> 10;
  #endif
  }
  
*** ../vim-7.3.576/src/os_msdos.c	2011-06-19 01:14:22.000000000 +0200
--- src/os_msdos.c	2012-06-29 15:33:26.000000000 +0200
***************
*** 550,564 ****
  #endif
  
  /*
!  * Return amount of memory currently available.
   */
      long_u
  mch_avail_mem(int special)
  {
  #ifdef DJGPP
!     return _go32_dpmi_remaining_virtual_memory();
  #else
!     return coreleft();
  #endif
  }
  
--- 550,564 ----
  #endif
  
  /*
!  * Return amount of memory currently available in Kbyte.
   */
      long_u
  mch_avail_mem(int special)
  {
  #ifdef DJGPP
!     return _go32_dpmi_remaining_virtual_memory() >> 10;
  #else
!     return coreleft() >> 10;
  #endif
  }
  
*** ../vim-7.3.576/src/os_win16.c	2011-10-20 18:24:16.000000000 +0200
--- src/os_win16.c	2012-06-29 15:34:18.000000000 +0200
***************
*** 379,391 ****
  
  
  /*
!  * How much memory is available?
   */
      long_u
  mch_avail_mem(
      int special)
  {
!     return GetFreeSpace(0);
  }
  
  
--- 379,391 ----
  
  
  /*
!  * How much memory is available in Kbyte?
   */
      long_u
  mch_avail_mem(
      int special)
  {
!     return GetFreeSpace(0) >> 10;
  }
  
  
*** ../vim-7.3.576/src/os_win32.c	2012-06-29 13:13:59.000000000 +0200
--- src/os_win32.c	2012-06-29 15:39:52.000000000 +0200
***************
*** 4992,5009 ****
  
  
  /*
!  * How much memory is available?
   * Return sum of available physical and page file memory.
   */
  /*ARGSUSED*/
      long_u
  mch_avail_mem(int special)
  {
!     MEMORYSTATUS	ms;
  
!     ms.dwLength = sizeof(MEMORYSTATUS);
!     GlobalMemoryStatus(&ms);
!     return (long_u) (ms.dwAvailPhys + ms.dwAvailPageFile);
  }
  
  #ifdef FEAT_MBYTE
--- 4992,5020 ----
  
  
  /*
!  * How much memory is available in Kbyte?
   * Return sum of available physical and page file memory.
   */
  /*ARGSUSED*/
      long_u
  mch_avail_mem(int special)
  {
!     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(MEMORYSTATUSEX);
! 	GlobalMemoryStatusEx(&ms);
! 	return (long_u)((ms.ullAvailPhys + ms.ullAvailPageFile) >> 10);
!     }
  }
  
  #ifdef FEAT_MBYTE
*** ../vim-7.3.576/src/version.c	2012-06-29 15:04:34.000000000 +0200
--- src/version.c	2012-06-29 15:45:44.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     577,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
75. You start wondering whether you could actually upgrade your brain
    with a Pentium Pro microprocessor 80.  The upgrade works just fine.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///