Bug 1237009 - avoid extra AddRef/Release in Android NativeZip JNI code; r=darchons

We don't need to take an extra ref when we're just going to release the
one we already have.  Just return our ref directly.
This commit is contained in:
Nathan Froyd 2016-01-04 20:18:41 -05:00
parent c85b24c6f8
commit 1e783350c8

View File

@ -68,8 +68,7 @@ Java_org_mozilla_gecko_mozglue_NativeZip_getZip(JNIEnv *jenv, jclass, jstring pa
JNI_Throw(jenv, "java/lang/IllegalArgumentException", "Invalid path or invalid zip");
return 0;
}
zip->AddRef();
return (jlong) zip.get();
return reinterpret_cast<jlong>(zip.forget().take());
}
extern "C"
@ -84,8 +83,7 @@ Java_org_mozilla_gecko_mozglue_NativeZip_getZipFromByteBuffer(JNIEnv *jenv, jcla
JNI_Throw(jenv, "java/lang/IllegalArgumentException", "Invalid zip");
return 0;
}
zip->AddRef();
return (jlong) zip.get();
return reinterpret_cast<jlong>(zip.forget().take());
}
extern "C"