Rename _zip_free to zip_discard and make it available in the public API.
It closes zip archives without saving changes.
--HG--
branch : HEAD
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 9cde52d..d1cb0c3 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -58,6 +58,7 @@
zip_close.c
zip_delete.c
zip_dirent.c
+ zip_discard.c
zip_entry_free.c
zip_entry_new.c
zip_err_str.c
@@ -79,7 +80,6 @@
zip_fopen_index.c
zip_fopen_index_encrypted.c
zip_fread.c
- zip_free.c
zip_get_archive_comment.c
zip_get_archive_flag.c
zip_get_compression_implementation.c
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 9ecf677..9a1c28d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -15,6 +15,7 @@
zip_close.c \
zip_delete.c \
zip_dirent.c \
+ zip_discard.c \
zip_entry_free.c \
zip_entry_new.c \
zip_err_str.c \
@@ -36,7 +37,6 @@
zip_fopen_index.c \
zip_fopen_index_encrypted.c \
zip_fread.c \
- zip_free.c \
zip_get_archive_comment.c \
zip_get_archive_flag.c \
zip_get_compression_implementation.c \
diff --git a/lib/zip.h b/lib/zip.h
index 980eb91..b34039f 100644
--- a/lib/zip.h
+++ b/lib/zip.h
@@ -218,6 +218,7 @@
ZIP_EXTERN zip_int64_t zip_add(struct zip *, const char *, struct zip_source *);
ZIP_EXTERN zip_int64_t zip_add_dir(struct zip *, const char *);
ZIP_EXTERN int zip_close(struct zip *);
+ZIP_EXTERN void zip_discard(struct zip *);
ZIP_EXTERN int zip_delete(struct zip *, zip_uint64_t);
ZIP_EXTERN void zip_error_clear(struct zip *);
ZIP_EXTERN void zip_error_get(struct zip *, int *, int *);
diff --git a/lib/zip_close.c b/lib/zip_close.c
index f815723..323d4ce 100644
--- a/lib/zip_close.c
+++ b/lib/zip_close.c
@@ -89,7 +89,7 @@
return -1;
if (!_zip_changed(za, &survivors)) {
- _zip_free(za);
+ zip_discard(za);
return 0;
}
@@ -101,7 +101,7 @@
return -1;
}
}
- _zip_free(za);
+ zip_discard(za);
return 0;
}
@@ -347,7 +347,7 @@
chmod(za->zn, 0666&~mask);
#endif
- _zip_free(za);
+ zip_discard(za);
free(temp);
return 0;
diff --git a/lib/zip_free.c b/lib/zip_discard.c
similarity index 93%
rename from lib/zip_free.c
rename to lib/zip_discard.c
index 9932c14..16cc3d8 100644
--- a/lib/zip_free.c
+++ b/lib/zip_discard.c
@@ -1,6 +1,6 @@
/*
- zip_free.c -- free struct zip
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ zip_discard.c -- discard and free struct zip
+ Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
@@ -39,12 +39,12 @@
-/* _zip_free:
+/* zip_discard:
frees the space allocated to a zipfile struct, and closes the
corresponding file. */
void
-_zip_free(struct zip *za)
+zip_discard(struct zip *za)
{
int i;
diff --git a/lib/zip_open.c b/lib/zip_open.c
index f147004..75e7670 100644
--- a/lib/zip_open.c
+++ b/lib/zip_open.c
@@ -124,7 +124,7 @@
else if ((za->entry=(struct zip_entry *)malloc(sizeof(*(za->entry))
* cdir->nentry)) == NULL) {
set_error(zep, NULL, ZIP_ER_MEMORY);
- _zip_free(za);
+ zip_discard(za);
return NULL;
}
for (i=0; i<cdir->nentry; i++)
@@ -460,7 +460,7 @@
else {
za->zn = strdup(fn);
if (!za->zn) {
- _zip_free(za);
+ zip_discard(za);
set_error(zep, NULL, ZIP_ER_MEMORY);
return NULL;
}
diff --git a/lib/zipint.h b/lib/zipint.h
index b39b786..2e21946 100644
--- a/lib/zipint.h
+++ b/lib/zipint.h
@@ -356,7 +356,6 @@
zip_uint64_t, zip_int64_t, const char *);
int _zip_changed(struct zip *, int *);
-void _zip_free(struct zip *);
const char *_zip_get_name(struct zip *, zip_uint64_t, int, struct zip_error *);
int _zip_local_header_read(struct zip *, int);
void *_zip_memdup(const void *, size_t, struct zip_error *);