From 87b0a4d253ab1549b351389f658238fe32a28da1 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 20 Mar 2017 16:57:33 -0400 Subject: Remove fz_drop_image_base. --- source/fitz/image.c | 21 ++++++--------------- source/fitz/store.c | 5 +++-- 2 files changed, 9 insertions(+), 17 deletions(-) (limited to 'source/fitz') diff --git a/source/fitz/image.c b/source/fitz/image.c index 58cd876d..261c9f09 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -109,7 +109,12 @@ static fz_store_type fz_image_store_type = void fz_drop_image(fz_context *ctx, fz_image *image) { - fz_drop_key_storable(ctx, &image->key_storable); + if (fz_drop_key_storable(ctx, &image->key_storable)) + { + fz_drop_colorspace(ctx, image->colorspace); + fz_drop_image(ctx, image->mask); + fz_free(ctx, image); + } } static void @@ -373,17 +378,6 @@ fz_drop_image_imp(fz_context *ctx, fz_storable *image_) image->drop_image(ctx, image); } -void -fz_drop_image_base(fz_context *ctx, fz_image *image) -{ - if (!image) - return; - - fz_drop_colorspace(ctx, image->colorspace); - fz_drop_image(ctx, image->mask); - fz_free(ctx, image); -} - static void drop_compressed_image(fz_context *ctx, fz_image *image_) { @@ -391,7 +385,6 @@ drop_compressed_image(fz_context *ctx, fz_image *image_) fz_drop_pixmap(ctx, image->tile); fz_drop_compressed_buffer(ctx, image->buffer); - fz_drop_image_base(ctx, &image->super); } static void @@ -400,7 +393,6 @@ drop_pixmap_image(fz_context *ctx, fz_image *image_) fz_pixmap_image *image = (fz_pixmap_image *)image_; fz_drop_pixmap(ctx, image->tile); - fz_drop_image_base(ctx, &image->super); } static fz_pixmap * @@ -1089,7 +1081,6 @@ static void drop_display_list_image(fz_context *ctx, fz_image *image_) if (image == NULL) return; fz_drop_display_list(ctx, image->list); - fz_drop_image_base(ctx, &image->super); } static size_t diff --git a/source/fitz/store.c b/source/fitz/store.c index b3996686..620bf0ea 100644 --- a/source/fitz/store.c +++ b/source/fitz/store.c @@ -168,7 +168,7 @@ do_reap(fz_context *ctx) } } -void fz_drop_key_storable(fz_context *ctx, const fz_key_storable *sc) +int fz_drop_key_storable(fz_context *ctx, const fz_key_storable *sc) { /* Explicitly drop const to allow us to use const * sanely throughout the code. */ @@ -177,7 +177,7 @@ void fz_drop_key_storable(fz_context *ctx, const fz_key_storable *sc) int unlock = 1; if (s == NULL) - return; + return 0; if (s->storable.refs > 0) (void)Memento_dropRef(s); @@ -211,6 +211,7 @@ void fz_drop_key_storable(fz_context *ctx, const fz_key_storable *sc) */ if (drop) s->storable.drop(ctx, &s->storable); + return drop; } void *fz_keep_key_storable_key(fz_context *ctx, const fz_key_storable *sc) -- cgit v1.2.3