summaryrefslogtreecommitdiffstats
path: root/include/ziparchive/zip_archive.h
diff options
context:
space:
mode:
authorPiotr Jastrzebski <haaawk@google.com>2014-08-08 14:02:17 +0100
committerPiotr Jastrzebski <haaawk@google.com>2014-08-11 07:58:00 +0100
commit79c8b34f36ef29d481e76ebd8af97992c894d58c (patch)
treef17eaaca7f4929257257ce058b08562bc9f021a9 /include/ziparchive/zip_archive.h
parent2f40ddf3f3e4ce88681311fc0e2321e2c54cd413 (diff)
downloadsystem_core-79c8b34f36ef29d481e76ebd8af97992c894d58c.zip
system_core-79c8b34f36ef29d481e76ebd8af97992c894d58c.tar.gz
system_core-79c8b34f36ef29d481e76ebd8af97992c894d58c.tar.bz2
Add EndIteration method to free memory allocated
in StartIteration. This method should always be called when the iteration is over to make sure that we don't leak memory. Change-Id: I5205c754dfafbab9bb5f06003c3663d2ec4e8a35
Diffstat (limited to 'include/ziparchive/zip_archive.h')
-rw-r--r--include/ziparchive/zip_archive.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/ziparchive/zip_archive.h b/include/ziparchive/zip_archive.h
index 1877494..27a9796 100644
--- a/include/ziparchive/zip_archive.h
+++ b/include/ziparchive/zip_archive.h
@@ -130,10 +130,10 @@ int32_t FindEntry(const ZipArchiveHandle handle, const char* entryName,
/*
* Start iterating over all entries of a zip file. The order of iteration
* is not guaranteed to be the same as the order of elements
- * in the central directory but is stable for a given zip file. |cookie|
- * must point to a writeable memory location, and will be set to the value
- * of an opaque cookie which can be used to make one or more calls to
- * Next.
+ * in the central directory but is stable for a given zip file. |cookie| will
+ * contain the value of an opaque cookie which can be used to make one or more
+ * calls to Next. All calls to StartIteration must be matched by a call to
+ * EndIteration to free any allocated memory.
*
* This method also accepts an optional prefix to restrict iteration to
* entry names that start with |prefix|.
@@ -152,6 +152,12 @@ int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr,
int32_t Next(void* cookie, ZipEntry* data, ZipEntryName *name);
/*
+ * End iteration over all entries of a zip file and frees the memory allocated
+ * in StartIteration.
+ */
+void EndIteration(void* cookie);
+
+/*
* Uncompress and write an entry to an open file identified by |fd|.
* |entry->uncompressed_length| bytes will be written to the file at
* its current offset, and the file will be truncated at the end of