| 1009 | } |
| 1010 | |
| 1011 | MMKV_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 | |
| 1020 | MMKV_JNI void destroyNB(JNIEnv *env, jobject instance, jlong pointer, jint size) { |
| 1021 | free(reinterpret_cast<void *>(pointer)); |
nothing calls this directly
no outgoing calls
no test coverage detected