void fz_drop_link(fz_context *ctx, fz_link *link) { if (link && --link->refs == 0) { fz_drop_link(ctx, link->next); fz_free_link_dest(ctx, &link->dest); fz_free(ctx, link); } }
void fz_drop_link(fz_context *ctx, fz_link *link) { while (link && --link->refs == 0) { fz_link *next = link->next; fz_free_link_dest(ctx, &link->dest); fz_free(ctx, link); link = next; } }
void fz_free_outline(fz_context *ctx, fz_outline *outline) { while (outline) { fz_outline *next = outline->next; fz_free_outline(ctx, outline->down); fz_free(ctx, outline->title); fz_free_link_dest(ctx, &outline->dest); fz_free(ctx, outline); outline = next; } }
fz_link * fz_new_link(fz_context *ctx, const fz_rect *bbox, fz_link_dest dest) { fz_link *link; fz_try(ctx) { link = fz_malloc_struct(ctx, fz_link); link->refs = 1; } fz_catch(ctx) { fz_free_link_dest(ctx, &dest); fz_rethrow(ctx); } link->dest = dest; link->rect = *bbox; link->next = NULL; return link; }