/* Currently nothing to do. */
}
+
+/* Destroy file handle.
+ Normally needed only if a file_handle needs to be re-assigned.
+ Otherwise, just let fh_done clean destroy the handle.
+ */
+void
+fh_free(struct file_handle *fh)
+{
+ if ( !fh->name )
+ return ;
+
+ free (fh->name);
+ fh->name = 0;
+ free (fh->filename);
+ fn_free_identity (fh->identity);
+ free (fh);
+}
+
+
/* Frees all the file handles. */
void
fh_done (void)
for (fh = file_handles; fh != NULL; fh = next)
{
next = fh->next;
- free (fh->name);
- free (fh->filename);
- fn_free_identity (fh->identity);
- free (fh);
+ fh_free(fh);
}
file_handles = NULL;
}
{
struct file_handle *handle;
+ assert(filename);
+ assert(handle_name);
+
/* Create and initialize file handle. */
handle = xmalloc (sizeof *handle);
handle->next = file_handles;