MCPcopy Create free account
hub / github.com/Tencent/MMKV / createNB

Function createNB

Android/MMKV/mmkv/src/main/cpp/native-bridge.cpp:1011–1018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1009}
1010
1011MMKV_JNI jlong createNB(JNIEnv *env, jobject instance, jint size) {
1012 auto ptr = malloc(static_cast<size_t>(size));
1013 if (!ptr) {
1014 MMKVError("fail to create NativeBuffer:%s", strerror(errno));
1015 return 0;
1016 }
1017 return reinterpret_cast<jlong>(ptr);
1018}
1019
1020MMKV_JNI void destroyNB(JNIEnv *env, jobject instance, jlong pointer, jint size) {
1021 free(reinterpret_cast<void *>(pointer));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected