Permalink
Browse files

Remove release from ReadableNativeArray and Map

Reviewed By: mhorowitz

Differential Revision: D6846268

fbshipit-source-id: 2f750a05ee63a744e7f64b3fe67736df3614ef3d
  • Loading branch information...
Kathy Gray authored and facebook-github-bot committed Feb 1, 2018
1 parent 88980f2 commit 28be33ac34d9214ffd452f88a4d19468683a6a0d
@@ -66,29 +66,24 @@ local_ref<JArrayClass<jobject>> ReadableNativeArray::importArray() {
break;
}
case folly::dynamic::Type::BOOL: {
jarray->
setElement(i,
JBoolean::valueOf(ReadableNativeArray::getBoolean(i)).release());
(*jarray)[i] = JBoolean::valueOf(ReadableNativeArray::getBoolean(i));
break;
}
case folly::dynamic::Type::INT64:
case folly::dynamic::Type::DOUBLE: {
jarray->setElement(i,
JDouble::valueOf(ReadableNativeArray::getDouble(i)).release());
(*jarray)[i] = JDouble::valueOf(ReadableNativeArray::getDouble(i));
break;
}
case folly::dynamic::Type::STRING: {
jarray->
setElement(i,
make_jstring(ReadableNativeArray::getString(i)).release());
(*jarray)[i] = make_jstring(ReadableNativeArray::getString(i));
break;
}
case folly::dynamic::Type::OBJECT: {
jarray->setElement(i,ReadableNativeArray::getMap(i).release());
(*jarray)[i] = ReadableNativeArray::getMap(i);
break;
}
case folly::dynamic::Type::ARRAY: {
jarray->setElement(i,ReadableNativeArray::getArray(i).release());
(*jarray)[i] = ReadableNativeArray::getArray(i);
break;
}
default:
@@ -26,7 +26,7 @@ local_ref<JArrayClass<jstring>> ReadableNativeMap::importKeys() {
jint size = keys_.value().size();
auto jarray = JArrayClass<jstring>::newArray(size);
for (jint i = 0; i < size; i++) {
jarray->setElement(i, make_jstring(keys_.value()[i].getString().c_str()).release());
(*jarray)[i] = make_jstring(keys_.value()[i].getString());
}
return jarray;
}
@@ -43,29 +43,26 @@ local_ref<JArrayClass<jobject>> ReadableNativeMap::importValues() {
break;
}
case folly::dynamic::Type::BOOL: {
jarray->
setElement(i,
JBoolean::valueOf(ReadableNativeMap::getBooleanKey(key)).release());
(*jarray)[i] =
JBoolean::valueOf(ReadableNativeMap::getBooleanKey(key));
break;
}
case folly::dynamic::Type::INT64:
case folly::dynamic::Type::DOUBLE: {
jarray->setElement(i,
JDouble::valueOf(ReadableNativeMap::getDoubleKey(key)).release());
(*jarray)[i] =
JDouble::valueOf(ReadableNativeMap::getDoubleKey(key));
break;
}
case folly::dynamic::Type::STRING: {
jarray->
setElement(i,
ReadableNativeMap::getStringKey(key).release());
(*jarray)[i] = ReadableNativeMap::getStringKey(key);
break;
}
case folly::dynamic::Type::OBJECT: {
jarray->setElement(i,ReadableNativeMap::getMapKey(key).release());
(*jarray)[i] = ReadableNativeMap::getMapKey(key);
break;
}
case folly::dynamic::Type::ARRAY: {
jarray->setElement(i,ReadableNativeMap::getArrayKey(key).release());
(*jarray)[i] = ReadableNativeMap::getArrayKey(key);
break;
}
default: {
@@ -82,7 +79,7 @@ local_ref<JArrayClass<jobject>> ReadableNativeMap::importTypes() {
auto jarray = JArrayClass<jobject>::newArray(size);
for (jint i = 0; i < size; i++) {
std::string key = keys_.value()[i].getString().c_str();
jarray->setElement(i, ReadableNativeMap::getValueType(key).release());
(*jarray)[i] = ReadableNativeMap::getValueType(key);
}
return jarray;
}

0 comments on commit 28be33a

Please sign in to comment.