diff options
| author | Eli Zaretskii | 2020-01-03 18:27:35 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2020-01-03 18:27:35 +0200 |
| commit | 2b6d702e5d2d572640c6bcd43f54138bacbe7ac8 (patch) | |
| tree | 0583cef4073643f6a9d1529d9df09089ae93e93c | |
| parent | fa7148fd5ac7c10c32a1cdcf57ade55bc3be8718 (diff) | |
| download | emacs-2b6d702e5d2d572640c6bcd43f54138bacbe7ac8.tar.gz emacs-2b6d702e5d2d572640c6bcd43f54138bacbe7ac8.zip | |
Fix the MS-Windows build broken by "Let the OS clear large new objects"
* src/w32heap.c (sys_calloc): New function, implements calloc
in terms of our private implementations of malloc.
* nt/inc/ms-w32.h (calloc): Redirect to sys_calloc.
| -rw-r--r-- | nt/inc/ms-w32.h | 3 | ||||
| -rw-r--r-- | src/w32heap.c | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 6d20c959a3f..3b1d3ff0393 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h | |||
| @@ -499,6 +499,8 @@ extern void *malloc_after_dump_9x(size_t); | |||
| 499 | extern void *realloc_after_dump_9x(void *, size_t); | 499 | extern void *realloc_after_dump_9x(void *, size_t); |
| 500 | extern void free_after_dump_9x(void *); | 500 | extern void free_after_dump_9x(void *); |
| 501 | 501 | ||
| 502 | extern void *sys_calloc(size_t, size_t); | ||
| 503 | |||
| 502 | extern malloc_fn the_malloc_fn; | 504 | extern malloc_fn the_malloc_fn; |
| 503 | extern realloc_fn the_realloc_fn; | 505 | extern realloc_fn the_realloc_fn; |
| 504 | extern free_fn the_free_fn; | 506 | extern free_fn the_free_fn; |
| @@ -506,6 +508,7 @@ extern free_fn the_free_fn; | |||
| 506 | #define malloc(size) (*the_malloc_fn)(size) | 508 | #define malloc(size) (*the_malloc_fn)(size) |
| 507 | #define free(ptr) (*the_free_fn)(ptr) | 509 | #define free(ptr) (*the_free_fn)(ptr) |
| 508 | #define realloc(ptr, size) (*the_realloc_fn)(ptr, size) | 510 | #define realloc(ptr, size) (*the_realloc_fn)(ptr, size) |
| 511 | #define calloc(num, size) sys_calloc(num, size) | ||
| 509 | 512 | ||
| 510 | #endif | 513 | #endif |
| 511 | 514 | ||
diff --git a/src/w32heap.c b/src/w32heap.c index 3a6c7804675..ececc73c026 100644 --- a/src/w32heap.c +++ b/src/w32heap.c | |||
| @@ -597,6 +597,16 @@ free_after_dump_9x (void *ptr) | |||
| 597 | } | 597 | } |
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | void * | ||
| 601 | sys_calloc (size_t number, size_t size) | ||
| 602 | { | ||
| 603 | size_t nbytes = number * size; | ||
| 604 | void *ptr = (*the_malloc_fn) (nbytes); | ||
| 605 | if (ptr) | ||
| 606 | memset (ptr, 0, nbytes); | ||
| 607 | return ptr; | ||
| 608 | } | ||
| 609 | |||
| 600 | #if defined HAVE_UNEXEC && defined ENABLE_CHECKING | 610 | #if defined HAVE_UNEXEC && defined ENABLE_CHECKING |
| 601 | void | 611 | void |
| 602 | report_temacs_memory_usage (void) | 612 | report_temacs_memory_usage (void) |