Don't use an array where none are necessary

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@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Thiago Macieira 2013-12-19 17:03:25 -08:00 committed by Dirk Hohndel
parent 64f24234ab
commit 3e3fff262e

View file

@ -133,7 +133,7 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
int streamsize; int streamsize;
char *membuf; char *membuf;
xmlDoc *transformed; 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. * 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. * Save the XML document into a zip file.
*/ */
snprintf(filename, PATH_MAX, "%d.xml", i + 1); snprintf(filename, PATH_MAX, "%d.xml", i + 1);
s[i] = zip_source_buffer(zip, membuf, streamsize, 1); s = zip_source_buffer(zip, membuf, streamsize, 1);
if (s[i]) { if (s) {
int64_t ret = zip_add(zip, filename, s[i]); int64_t ret = zip_add(zip, filename, s);
if (ret == -1) if (ret == -1)
qDebug() << errPrefix << "failed to include dive:" << i; qDebug() << errPrefix << "failed to include dive:" << i;
} }