diff options
Diffstat (limited to 'fitz/doc_link.c')
-rw-r--r-- | fitz/doc_link.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/fitz/doc_link.c b/fitz/doc_link.c deleted file mode 100644 index 30dca222..00000000 --- a/fitz/doc_link.c +++ /dev/null @@ -1,65 +0,0 @@ -#include "mupdf/fitz.h" - -void -fz_free_link_dest(fz_context *ctx, fz_link_dest *dest) -{ - switch (dest->kind) - { - case FZ_LINK_NONE: - case FZ_LINK_GOTO: - break; - case FZ_LINK_URI: - fz_free(ctx, dest->ld.uri.uri); - break; - case FZ_LINK_LAUNCH: - fz_free(ctx, dest->ld.launch.file_spec); - break; - case FZ_LINK_NAMED: - fz_free(ctx, dest->ld.named.named); - break; - case FZ_LINK_GOTOR: - fz_free(ctx, dest->ld.gotor.file_spec); - break; - } -} - -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; -} - -fz_link * -fz_keep_link(fz_context *ctx, fz_link *link) -{ - if (link) - link->refs++; - return 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; - } -} |