> And then call those callbacks in the existing pdf_fsys_create and > pdf_fsys_destroy. Stateless filesystems (such as the disk filesystem) > would not define those callbacks. > > Would this fit your needs?
This is exactly what I had in mind. I pushed a patch providing support for both init_fn and cleanup_fn. Note that the filesystem state created at init_fn time is only available at cleanup_fn time. If you need to access the state in some of the other filesystem implementation functions we will need to add a new parameter to the appropriate callback and to change the pdf_fsys_* function to include fsys->data when calling that callback. Another caveat of this solution is that init_fn/cleanup_fn are never called for the default filesystem (I added pdf_fsys_disk_init and pdf_fsys_disk_cleanup for completeness). But since the disk filesystem is stateless that should not be a problem. -- Jose E. Marchesi <[email protected]> http://www.jemarch.net GNU Project http://www.gnu.org
