From 8bc4b23c8741b3d2de77e21e1d4c6b3da82f9a64 Mon Sep 17 00:00:00 2001 From: beliefer Date: Tue, 28 Oct 2025 16:07:40 +0800 Subject: [PATCH 1/2] [MINOR] Replace NULL with nullptr --- cpp/velox/jni/VeloxJniWrapper.cc | 6 +++--- cpp/velox/memory/VeloxMemoryManager.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/velox/jni/VeloxJniWrapper.cc b/cpp/velox/jni/VeloxJniWrapper.cc index 00528801435..6a3357dab5e 100644 --- a/cpp/velox/jni/VeloxJniWrapper.cc +++ b/cpp/velox/jni/VeloxJniWrapper.cc @@ -608,7 +608,7 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_monitor_VeloxMemoryProfiler_start( JNI_METHOD_START #ifdef ENABLE_JEMALLOC_STATS bool active = true; - mallctl("prof.active", NULL, NULL, &active, sizeof(bool)); + mallctl("prof.active", nullptr, nullptr, &active, sizeof(bool)); #endif JNI_METHOD_END() } @@ -618,7 +618,7 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_monitor_VeloxMemoryProfiler_dump( jclass) { JNI_METHOD_START #ifdef ENABLE_JEMALLOC_STATS - mallctl("prof.dump", NULL, NULL, NULL, 0); + mallctl("prof.dump", nullptr, nullptr, nullptr, 0); #endif JNI_METHOD_END() } @@ -629,7 +629,7 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_monitor_VeloxMemoryProfiler_stop( JNI_METHOD_START #ifdef ENABLE_JEMALLOC_STATS bool active = false; - mallctl("prof.active", NULL, NULL, &active, sizeof(bool)); + mallctl("prof.active", nullptr, nullptr, &active, sizeof(bool)); #endif JNI_METHOD_END() } diff --git a/cpp/velox/memory/VeloxMemoryManager.cc b/cpp/velox/memory/VeloxMemoryManager.cc index ec568fa6a6d..d5c71d78e62 100644 --- a/cpp/velox/memory/VeloxMemoryManager.cc +++ b/cpp/velox/memory/VeloxMemoryManager.cc @@ -467,7 +467,7 @@ VeloxMemoryManager::~VeloxMemoryManager() { << "ms as there are still outstanding memory resources. "; } #ifdef ENABLE_JEMALLOC_STATS - malloc_stats_print(NULL, NULL, NULL); + malloc_stats_print(nullptr, nullptr, nullptr); #endif } From 10fe7a91b0ddc5f8ffd2214ffe1817e78e7524e0 Mon Sep 17 00:00:00 2001 From: beliefer Date: Thu, 30 Oct 2025 17:23:55 +0800 Subject: [PATCH 2/2] Update CppCodingStyle --- docs/developers/CppCodingStyle.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/developers/CppCodingStyle.md b/docs/developers/CppCodingStyle.md index 2cea8fe8feb..aacae6f3d7e 100644 --- a/docs/developers/CppCodingStyle.md +++ b/docs/developers/CppCodingStyle.md @@ -125,6 +125,8 @@ cmake-format --first-comment-is-literal True --in-place cpp/velox/CMakeLists.txt ## Constant * Prefer const variables to using preprocessor (`#define`) to define constant values. +* Always use nullptr if you need a constant that represents a null pointer (T* for some T); + use 0 otherwise for a zero value. ## Macro