aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuanma Barranquero2002-10-28 17:50:21 +0000
committerJuanma Barranquero2002-10-28 17:50:21 +0000
commitce20e03e00355396a9ef1c8678d2368720c5dc73 (patch)
treed2700ba721424b49108fb81c16db8685b28cdecb /src
parent02e740dc0388eb1ed03258d55ab8bde505f3085f (diff)
downloademacs-ce20e03e00355396a9ef1c8678d2368720c5dc73.tar.gz
emacs-ce20e03e00355396a9ef1c8678d2368720c5dc73.zip
Don't redefine _heap_init and _heap_term on MSVC 7 build environments. Patch
from Jay Finger <jay_finger@hotmail.com> and Harald.Maier.BW@t-online.de.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/w32heap.c30
2 files changed, 21 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4016e01acc1..b20c6d3b71c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12002-10-28 Juanma Barranquero <lektu@terra.es>
2
3 * w32heap.c: Don't redefine _heap_init and _heap_term on MSVC 7 build
4 environments. Patch from Jay Finger <jay_finger@hotmail.com> and
5 Harald.Maier.BW@t-online.de.
6
12002-10-27 Kim F. Storm <storm@cua.dk> 72002-10-27 Kim F. Storm <storm@cua.dk>
2 8
3 * xterm.c (note_mouse_highlight): Don't use mouse-face if hidden. 9 * xterm.c (note_mouse_highlight): Don't use mouse-face if hidden.
diff --git a/src/w32heap.c b/src/w32heap.c
index e90213a6c36..11ec7c1b6c6 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -58,9 +58,9 @@ int os_subtype;
58void 58void
59cache_system_info (void) 59cache_system_info (void)
60{ 60{
61 union 61 union
62 { 62 {
63 struct info 63 struct info
64 { 64 {
65 char major; 65 char major;
66 char minor; 66 char minor;
@@ -157,11 +157,11 @@ sbrk (unsigned long increment)
157{ 157{
158 void *result; 158 void *result;
159 long size = (long) increment; 159 long size = (long) increment;
160 160
161 result = data_region_end; 161 result = data_region_end;
162 162
163 /* If size is negative, shrink the heap by decommitting pages. */ 163 /* If size is negative, shrink the heap by decommitting pages. */
164 if (size < 0) 164 if (size < 0)
165 { 165 {
166 int new_size; 166 int new_size;
167 unsigned char *new_data_region_end; 167 unsigned char *new_data_region_end;
@@ -172,7 +172,7 @@ sbrk (unsigned long increment)
172 if ((data_region_end - size) < data_region_base) 172 if ((data_region_end - size) < data_region_base)
173 return NULL; 173 return NULL;
174 174
175 /* We can only decommit full pages, so allow for 175 /* We can only decommit full pages, so allow for
176 partial deallocation [cga]. */ 176 partial deallocation [cga]. */
177 new_data_region_end = (data_region_end - size); 177 new_data_region_end = (data_region_end - size);
178 new_data_region_end = (unsigned char *) 178 new_data_region_end = (unsigned char *)
@@ -188,9 +188,9 @@ sbrk (unsigned long increment)
188 } 188 }
189 189
190 data_region_end -= size; 190 data_region_end -= size;
191 } 191 }
192 /* If size is positive, grow the heap by committing reserved pages. */ 192 /* If size is positive, grow the heap by committing reserved pages. */
193 else if (size > 0) 193 else if (size > 0)
194 { 194 {
195 /* Sanity checks. */ 195 /* Sanity checks. */
196 if ((data_region_end + size) > 196 if ((data_region_end + size) >
@@ -209,7 +209,7 @@ sbrk (unsigned long increment)
209 real_data_region_end = (unsigned char *) 209 real_data_region_end = (unsigned char *)
210 ((long) (data_region_end + syspage_mask) & ~syspage_mask); 210 ((long) (data_region_end + syspage_mask) & ~syspage_mask);
211 } 211 }
212 212
213 return result; 213 return result;
214} 214}
215 215
@@ -232,7 +232,7 @@ init_heap ()
232 PIMAGE_NT_HEADERS nt_header; 232 PIMAGE_NT_HEADERS nt_header;
233 233
234 dos_header = (PIMAGE_DOS_HEADER) RVA_TO_PTR (0); 234 dos_header = (PIMAGE_DOS_HEADER) RVA_TO_PTR (0);
235 nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) + 235 nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) +
236 dos_header->e_lfanew); 236 dos_header->e_lfanew);
237 preload_heap_section = find_section ("EMHEAP", nt_header); 237 preload_heap_section = find_section ("EMHEAP", nt_header);
238 238
@@ -247,7 +247,7 @@ init_heap ()
247 247
248 /* Ensure that the addresses don't use the upper tag bits since 248 /* Ensure that the addresses don't use the upper tag bits since
249 the Lisp type goes there. */ 249 the Lisp type goes there. */
250 if (((unsigned long) data_region_base & ~VALMASK) != 0) 250 if (((unsigned long) data_region_base & ~VALMASK) != 0)
251 { 251 {
252 printf ("Error: The heap was allocated in upper memory.\n"); 252 printf ("Error: The heap was allocated in upper memory.\n");
253 exit (1); 253 exit (1);
@@ -274,15 +274,15 @@ round_heap (unsigned long align)
274{ 274{
275 unsigned long needs_to_be; 275 unsigned long needs_to_be;
276 unsigned long need_to_alloc; 276 unsigned long need_to_alloc;
277 277
278 needs_to_be = (unsigned long) ROUND_UP (get_heap_end (), align); 278 needs_to_be = (unsigned long) ROUND_UP (get_heap_end (), align);
279 need_to_alloc = needs_to_be - (unsigned long) get_heap_end (); 279 need_to_alloc = needs_to_be - (unsigned long) get_heap_end ();
280 280
281 if (need_to_alloc) 281 if (need_to_alloc)
282 sbrk (need_to_alloc); 282 sbrk (need_to_alloc);
283} 283}
284 284
285#if (_MSC_VER >= 1000 && !defined(USE_CRT_DLL)) 285#if (_MSC_VER >= 1000 && _MSC_VER < 1300 && !defined(USE_CRT_DLL))
286 286
287/* MSVC 4.2 invokes these functions from mainCRTStartup to initialize 287/* MSVC 4.2 invokes these functions from mainCRTStartup to initialize
288 a heap via HeapCreate. They are normally defined by the runtime, 288 a heap via HeapCreate. They are normally defined by the runtime,