Skip to content

Commit

Permalink
use nullptr instead of NULL / 0 in rocksdbjni (facebook#12575)
Browse files Browse the repository at this point in the history
Summary:
While I was trying to understand issue facebook#12503, I found this minor problem. Please have a look adamretter rhubner

Pull Request resolved: facebook#12575

Reviewed By: ajkr

Differential Revision: D57596055

Pulled By: cbi42

fbshipit-source-id: ee0860bdfbee9364cd30c23957b72a04da6acd45
  • Loading branch information
dfa1 authored and konstantinvilin committed May 22, 2024
1 parent 9b8ff1e commit 0bdbe6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions java/rocksjni/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3917,7 +3917,7 @@ jlongArray Java_org_rocksdb_Options_tablePropertiesCollectorFactory(
// exception thrown: OutOfMemoryError
return nullptr;
}
jlong* buf = env->GetLongArrayElements(retVal, NULL);
jlong* buf = env->GetLongArrayElements(retVal, nullptr);
if (buf == nullptr) {
// exception thrown: OutOfMemoryError
return nullptr;
Expand All @@ -3943,7 +3943,7 @@ void Java_org_rocksdb_Options_setTablePropertiesCollectorFactory(
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::Options*>(jhandle);
const jsize size = env->GetArrayLength(j_factory_handles);

jlong* buf = env->GetLongArrayElements(j_factory_handles, NULL);
jlong* buf = env->GetLongArrayElements(j_factory_handles, nullptr);
if (buf == nullptr) {
// exception thrown: OutOfMemoryError
return;
Expand Down
2 changes: 1 addition & 1 deletion java/rocksjni/portal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,7 @@ class JniUtil {
} else if (env_rs == JNI_EDETACHED) {
// current thread is not attached, attempt to attach
const jint rs_attach =
jvm->AttachCurrentThread(reinterpret_cast<void**>(&env), NULL);
jvm->AttachCurrentThread(reinterpret_cast<void**>(&env), nullptr);
if (rs_attach == JNI_OK) {
*attached = JNI_TRUE;
return env;
Expand Down
2 changes: 1 addition & 1 deletion java/rocksjni/ttl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ jlongArray Java_org_rocksdb_TtlDB_openCF(JNIEnv* env, jclass, jlong jopt_handle,
return jresults;
} else {
ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s);
return NULL;
return nullptr;
}
}

Expand Down

0 comments on commit 0bdbe6b

Please sign in to comment.