static fz_document * epub_init(fz_context *ctx, fz_archive *zip) { epub_document *doc; doc = fz_new_document(ctx, epub_document); doc->zip = zip; doc->set = fz_new_html_font_set(ctx); doc->super.drop_document = epub_drop_document; doc->super.layout = epub_layout; doc->super.load_outline = epub_load_outline; doc->super.resolve_link = epub_resolve_link; doc->super.count_pages = epub_count_pages; doc->super.load_page = epub_load_page; doc->super.lookup_metadata = epub_lookup_metadata; doc->super.is_reflowable = 1; fz_try(ctx) { epub_parse_header(ctx, doc); } fz_catch(ctx) { fz_drop_document(ctx, &doc->super); fz_rethrow(ctx); } return (fz_document*)doc; }
static fz_document * epub_init(fz_context *ctx, fz_archive *zip) { epub_document *doc; doc = fz_malloc_struct(ctx, epub_document); doc->zip = zip; doc->set = fz_new_html_font_set(ctx); doc->super.close = epub_close_document; doc->super.layout = epub_layout; doc->super.count_pages = epub_count_pages; doc->super.load_page = epub_load_page; fz_try(ctx) { epub_parse_header(ctx, doc); } fz_catch(ctx) { epub_close_document(ctx, (fz_document*)doc); fz_rethrow(ctx); } return (fz_document*)doc; }