From 93c38d5cbb97690e06defc8b383d4a289b84baec Mon Sep 17 00:00:00 2001 From: lijiawei Date: Sun, 9 Oct 2022 18:41:32 +0800 Subject: [PATCH] fix warning: undefined preprocessor symbol: false Signed-off-by: lijiawei --- libpurgeablemem/common/include/pm_util.h | 8 ++++---- libpurgeablemem/common/src/ux_page_table_c.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libpurgeablemem/common/include/pm_util.h b/libpurgeablemem/common/include/pm_util.h index 954e7ee..427fcef 100644 --- a/libpurgeablemem/common/include/pm_util.h +++ b/libpurgeablemem/common/include/pm_util.h @@ -23,12 +23,12 @@ extern "C" { #endif /* End of #ifdef __cplusplus */ /* - * USE_UXPT is true means using uxpt using uxpt in libpurgeable, - * while false means not using uxpt, false will be used in the following cases: + * USE_UXPT > 0 means enable uxpt(using uxpt) in libpurgeable, + * while USE_UXPT == 0 means not using uxpt, 0 will be used in the following cases: * case 1: if there is no purgeable mem module in kernel. * case 2: if you want close libpurgeable, meanwhile doesn't affect user programs. */ -#define USE_UXPT true +#define USE_UXPT 1 #define MAP_PURGEABLE 0x04 #define MAP_USEREXPTE 0x08 @@ -44,7 +44,7 @@ extern "C" { * of user programs, this lib will provide normal anon memory. So * MAP_PURGEABLE is set to 0x0. */ -#if (USE_UXPT == false) +#if !defined(USE_UXPT) || (USE_UXPT == 0) #undef MAP_PURGEABLE #define MAP_PURGEABLE 0x0 #undef MAP_USEREXPTE diff --git a/libpurgeablemem/common/src/ux_page_table_c.c b/libpurgeablemem/common/src/ux_page_table_c.c index ed9674b..c6aa08f 100644 --- a/libpurgeablemem/common/src/ux_page_table_c.c +++ b/libpurgeablemem/common/src/ux_page_table_c.c @@ -24,7 +24,7 @@ #undef LOG_TAG #define LOG_TAG "PurgeableMemC: UPT" -#if defined(USE_UXPT) && (USE_UXPT == true) /* (USE_UXPT == true) means using uxpt */ +#if defined(USE_UXPT) && (USE_UXPT > 0) /* (USE_UXPT > 0) means using uxpt */ /* * using uint64_t as uxpte_t to avoid avoid confusion on 32-bit and 64 bit systems. @@ -385,7 +385,7 @@ static int UnmapUxptePages_(uxpte_t *ptes, size_t size) return munmap(ptes, size); } -#else /* !(defined(USE_UXPT) && (USE_UXPT == true)), it means does not using uxpt */ +#else /* !(defined(USE_UXPT) && (USE_UXPT <= 0)), it means does not using uxpt */ typedef struct UserExtendPageTable { /* i am empty */ @@ -420,4 +420,4 @@ bool UxpteIsPresent(UxPageTableStruct *upt, uint64_t addr, size_t len) return true; } -#endif /* USE_UXPT == true */ +#endif /* USE_UXPT > 0 */ -- Gitee