summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Jastrzebski <haaawk@google.com>2014-08-08 16:12:14 +0100
committerPiotr Jastrzebski <haaawk@google.com>2014-08-11 08:15:08 +0100
commit63395c66f533eb891a94baf7a984d616829ac340 (patch)
tree79076b7ee656a531f0213eda4eb982b3f6f77aac
parente1319c51b44045c37dad120a688b2888b29bbc17 (diff)
downloadlibcore-63395c66f533eb891a94baf7a984d616829ac340.zip
libcore-63395c66f533eb891a94baf7a984d616829ac340.tar.gz
libcore-63395c66f533eb891a94baf7a984d616829ac340.tar.bz2
Stop keeping iteration prefix around.
zip archive makes a copy of a prefix and maintains it's lifecycle now. Change-Id: I55adc4c9eefee96b80038fb7dbb95dbe498d5a73
-rw-r--r--luni/src/main/native/java_util_jar_StrictJarFile.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/luni/src/main/native/java_util_jar_StrictJarFile.cpp b/luni/src/main/native/java_util_jar_StrictJarFile.cpp
index 590477e..e22e832 100644
--- a/luni/src/main/native/java_util_jar_StrictJarFile.cpp
+++ b/luni/src/main/native/java_util_jar_StrictJarFile.cpp
@@ -70,26 +70,20 @@ static jlong StrictJarFile_nativeOpenJarFile(JNIEnv* env, jobject, jstring fileN
class IterationHandle {
public:
- IterationHandle(const char* prefix) :
- cookie_(NULL), prefix_(strdup(prefix)) {
+ IterationHandle() :
+ cookie_(NULL) {
}
void** CookieAddress() {
return &cookie_;
}
- const char* Prefix() const {
- return prefix_;
- }
-
~IterationHandle() {
- free(prefix_);
EndIteration(cookie_);
}
private:
void* cookie_;
- char* prefix_;
};
@@ -100,14 +94,14 @@ static jlong StrictJarFile_nativeStartIteration(JNIEnv* env, jobject, jlong nati
return static_cast<jlong>(-1);
}
- IterationHandle* handle = new IterationHandle(prefixChars.c_str());
+ IterationHandle* handle = new IterationHandle();
int32_t error = 0;
if (prefixChars.size() == 0) {
error = StartIteration(reinterpret_cast<ZipArchiveHandle>(nativeHandle),
handle->CookieAddress(), NULL);
} else {
error = StartIteration(reinterpret_cast<ZipArchiveHandle>(nativeHandle),
- handle->CookieAddress(), handle->Prefix());
+ handle->CookieAddress(), prefixChars.c_str());
}
if (error) {