From 233c3bbeaaa9a9f463d95c98884b6efefbad8fe5 Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Wed, 14 Feb 2018 11:30:43 -0800 Subject: [PATCH] Simplify dump_discard_mem conditional --- src/pdumper.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/pdumper.c b/src/pdumper.c index a36ec3abecb..0df41cb127a 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -4256,26 +4256,18 @@ struct dump_memory_map { static void dump_discard_mem (void *mem, size_t size) { - if (VM_SUPPORTED == VM_MS_WINDOWS) - { #if VM_SUPPORTED == VM_MS_WINDOWS /* Discard COWed pages. */ (void) VirtualFree (mem, size, MEM_DECOMMIT); /* Release the commit charge for the mapping. */ (void) VirtualProtect (mem, size, PAGE_NOACCESS, NULL); -#endif - } - else if (VM_SUPPORTED == VM_POSIX) - { -#ifdef HAVE_POSIX_MADVISE +#elif VM_SUPPORTED == VM_POSIX +# ifdef HAVE_POSIX_MADVISE /* Discard COWed pages. */ (void) posix_madvise (mem, size, POSIX_MADV_DONTNEED); -#endif - /* Release the commit charge for the mapping. */ +# endif (void) mprotect (mem, size, PROT_NONE); - } - else - /* Do nothing */; +#endif } static void -- 2.39.5