archive: use reference counting for archive+input

Make the input_stream implementation hold a reference on the
archive_file object.  Allow the caller to "close" the archive_file
object immediately, no matter if the open_stream() method has
succeeded or not.
This commit is contained in:
Max Kellermann
2009-12-31 10:02:55 +01:00
parent 032c5376ad
commit aad05fd138
5 changed files with 32 additions and 8 deletions

View File

@@ -67,12 +67,9 @@ input_archive_open(struct input_stream *is, const char *pathname,
//setup fileops
opened = archive_file_open_stream(file, is, filename, error_r);
archive_file_close(file);
g_free(pname);
if (!opened) {
archive_file_close(file);
}
return opened;
}