[PATCH 5/5] Don't use an array where none are necessary

Thiago Macieira thiago at macieira.org
Thu Dec 19 17:03:25 UTC 2013


We don't need to keep the array of zip_source structs. We just need the
latest we created so we can add to the zip file.

Signed-off-by: Thiago Macieira <thiago at macieira.org>
---
 qt-ui/subsurfacewebservices.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 6040800..d5a2875 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -133,7 +133,7 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
 		int streamsize;
 		char *membuf;
 		xmlDoc *transformed;
-		struct zip_source *s[dive_table.nr];
+		struct zip_source *s;
 
 		/*
 		 * Get the i'th dive in XML format so we can process it.
@@ -187,9 +187,9 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
 		 * Save the XML document into a zip file.
 		 */
 		snprintf(filename, PATH_MAX, "%d.xml", i + 1);
-		s[i] = zip_source_buffer(zip, membuf, streamsize, 1);
-		if (s[i]) {
-			int64_t ret = zip_add(zip, filename, s[i]);
+		s = zip_source_buffer(zip, membuf, streamsize, 1);
+		if (s) {
+			int64_t ret = zip_add(zip, filename, s);
 			if (ret == -1)
 				qDebug() << errPrefix << "failed to include dive:" << i;
 		}
-- 
1.7.11.7



More information about the subsurface mailing list