From 290ddba35e7a1463c1a9fc5ff6bd723cd1670ba2 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Mon, 8 May 2023 10:08:20 +1000 Subject: Minor whitespace and small logic flow improvements on review Quality improvements from BenBE as part of review for #1234. --- darwin/DarwinMachine.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'darwin') diff --git a/darwin/DarwinMachine.c b/darwin/DarwinMachine.c index 6bf52b76..1290e959 100644 --- a/darwin/DarwinMachine.c +++ b/darwin/DarwinMachine.c @@ -1,6 +1,7 @@ /* htop - DarwinMachine.c (C) 2014 Hisham H. Muhammad +(C) 2023 htop dev team Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ @@ -33,12 +34,17 @@ static void DarwinMachine_getHostInfo(host_basic_info_data_t* p) { } static void DarwinMachine_freeCPULoadInfo(processor_cpu_load_info_t* p) { - if (NULL != p && NULL != *p) { - if (0 != munmap(*p, vm_page_size)) { - CRT_fatalError("Unable to free old CPU load information"); - } - *p = NULL; + if (!p) + return; + + if (!*p) + return; + + if (0 != munmap(*p, vm_page_size)) { + CRT_fatalError("Unable to free old CPU load information"); } + + *p = NULL; } static unsigned DarwinMachine_allocateCPULoadInfo(processor_cpu_load_info_t* p) { -- cgit v1.2.3