struct gnumeric_reader
{
struct spreadsheet spreadsheet;
+ int ref_cnt;
/* The libxml reader for this instance */
xmlTextReaderPtr xtr;
gnumeric_destroy (struct spreadsheet *s)
{
struct gnumeric_reader *r = s;
- int i;
- for (i = 0; i < s->n_sheets; ++i)
+ if (0 == --r->ref_cnt)
{
- xmlFree (r->sheets[i].name);
- }
+ int i;
+
+ for (i = 0; i < s->n_sheets; ++i)
+ {
+ xmlFree (r->sheets[i].name);
+ }
- free (r->sheets);
+ free (r->sheets);
- free (r);
+ free (r);
+ }
}
r->row = r->col = -1;
r->state = STATE_PRE_INIT;
r->xtr = xtr;
+ r->ref_cnt++;
/* Advance to the start of the workbook.
This gives us some confidence that we are actually dealing with a gnumeric
if (r->row != -1)
r = gnumeric_reopen (r, NULL, true);
+
+
if ( opts->cell_range )
{
if ( ! convert_cell_ref (opts->cell_range,