diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2015-01-20 16:42:29 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2015-02-17 16:36:10 +0100 |
commit | 681039767f2ccc72e236246178893eb0989169c9 (patch) | |
tree | 2eccad54c5b5bc964335dc97fe5b0fec8449d16e /source/fitz | |
parent | 76a09166ddbe5b741f54f0fd203f2135e5b532c3 (diff) | |
download | mupdf-681039767f2ccc72e236246178893eb0989169c9.tar.xz |
Rename fz_close_* and fz_free_* to fz_drop_*.
Rename fz_close to fz_drop_stream.
Rename fz_close_archive to fz_drop_archive.
Rename fz_close_output to fz_drop_output.
Rename fz_free_* to fz_drop_*.
Rename pdf_free_* to pdf_drop_*.
Rename xps_free_* to xps_drop_*.
Diffstat (limited to 'source/fitz')
40 files changed, 165 insertions, 165 deletions
diff --git a/source/fitz/bbox-device.c b/source/fitz/bbox-device.c index 8a298fe1..b8e63b56 100644 --- a/source/fitz/bbox-device.c +++ b/source/fitz/bbox-device.c @@ -180,7 +180,7 @@ fz_bbox_end_tile(fz_device *dev) } static void -fz_bbox_free_user(fz_device *dev) +fz_bbox_drop_user(fz_device *dev) { fz_bbox_data *data = dev->user; if (data->top > 0) @@ -198,7 +198,7 @@ fz_new_bbox_device(fz_context *ctx, fz_rect *result) user->top = 0; user->ignore = 0; dev = fz_new_device(ctx, user); - dev->free_user = fz_bbox_free_user; + dev->drop_user = fz_bbox_drop_user; dev->fill_path = fz_bbox_fill_path; dev->stroke_path = fz_bbox_stroke_path; diff --git a/source/fitz/buffer.c b/source/fitz/buffer.c index acfdc20a..12de453a 100644 --- a/source/fitz/buffer.c +++ b/source/fitz/buffer.c @@ -370,7 +370,7 @@ fz_test_buffer_write(fz_context *ctx) fprintf(stderr, "Copied buffer is different!\n"); fz_seek(stm, 0, 0); } - fz_close(stm); + fz_drop_stream(stm); fz_drop_buffer(ctx, master); fz_drop_buffer(ctx, copy); } diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c index 87b49413..f1dff20c 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -3,7 +3,7 @@ #define SLOWCMYK void -fz_free_colorspace_imp(fz_context *ctx, fz_storable *cs_) +fz_drop_colorspace_imp(fz_context *ctx, fz_storable *cs_) { fz_colorspace *cs = (fz_colorspace *)cs_; @@ -15,8 +15,8 @@ fz_free_colorspace_imp(fz_context *ctx, fz_storable *cs_) fz_colorspace * fz_new_colorspace(fz_context *ctx, char *name, int n) { - fz_colorspace *cs = Memento_label(fz_malloc(ctx, sizeof(fz_colorspace)), "fz_colorspace"); - FZ_INIT_STORABLE(cs, 1, fz_free_colorspace_imp); + fz_colorspace *cs = fz_malloc_struct(ctx, fz_colorspace); + FZ_INIT_STORABLE(cs, 1, fz_drop_colorspace_imp); cs->size = sizeof(fz_colorspace); fz_strlcpy(cs->name, name, sizeof cs->name); cs->n = n; @@ -169,10 +169,10 @@ static void rgb_to_cmyk(fz_context *ctx, fz_colorspace *cs, const float *rgb, fl cmyk[3] = k; } -static fz_colorspace k_default_gray = { {-1, fz_free_colorspace_imp}, 0, "DeviceGray", 1, gray_to_rgb, rgb_to_gray }; -static fz_colorspace k_default_rgb = { {-1, fz_free_colorspace_imp}, 0, "DeviceRGB", 3, rgb_to_rgb, rgb_to_rgb }; -static fz_colorspace k_default_bgr = { {-1, fz_free_colorspace_imp}, 0, "DeviceBGR", 3, bgr_to_rgb, rgb_to_bgr }; -static fz_colorspace k_default_cmyk = { {-1, fz_free_colorspace_imp}, 0, "DeviceCMYK", 4, cmyk_to_rgb, rgb_to_cmyk }; +static fz_colorspace k_default_gray = { {-1, fz_drop_colorspace_imp}, 0, "DeviceGray", 1, gray_to_rgb, rgb_to_gray }; +static fz_colorspace k_default_rgb = { {-1, fz_drop_colorspace_imp}, 0, "DeviceRGB", 3, rgb_to_rgb, rgb_to_rgb }; +static fz_colorspace k_default_bgr = { {-1, fz_drop_colorspace_imp}, 0, "DeviceBGR", 3, bgr_to_rgb, rgb_to_bgr }; +static fz_colorspace k_default_cmyk = { {-1, fz_drop_colorspace_imp}, 0, "DeviceCMYK", 4, cmyk_to_rgb, rgb_to_cmyk }; static fz_colorspace *fz_default_gray = &k_default_gray; static fz_colorspace *fz_default_rgb = &k_default_rgb; @@ -948,7 +948,7 @@ fz_std_conv_pixmap(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src) } } - fz_free_hash(ctx, lookup); + fz_drop_hash(ctx, lookup); } } @@ -1337,7 +1337,7 @@ void fz_init_cached_color_converter(fz_context *ctx, fz_color_converter *cc, fz_ } fz_catch(ctx) { - fz_free_hash(ctx, cached->hash); + fz_drop_hash(ctx, cached->hash); fz_rethrow(ctx); } } @@ -1363,6 +1363,6 @@ void fz_fin_cached_color_converter(fz_color_converter *cc_) if (v) fz_free(ctx, v); } - fz_free_hash(ctx, cc->hash); + fz_drop_hash(ctx, cc->hash); fz_free(ctx, cc); } diff --git a/source/fitz/compressed-buffer.c b/source/fitz/compressed-buffer.c index 1a863309..48f88eff 100644 --- a/source/fitz/compressed-buffer.c +++ b/source/fitz/compressed-buffer.c @@ -4,7 +4,7 @@ * pulled into cmapdump.c */ void -fz_free_compressed_buffer(fz_context *ctx, fz_compressed_buffer *buf) +fz_drop_compressed_buffer(fz_context *ctx, fz_compressed_buffer *buf) { if (!buf) return; diff --git a/source/fitz/context.c b/source/fitz/context.c index 36ad879f..b3ca9b5b 100644 --- a/source/fitz/context.c +++ b/source/fitz/context.c @@ -43,7 +43,7 @@ fz_keep_id_context(fz_context *ctx) } void -fz_free_context(fz_context *ctx) +fz_drop_context(fz_context *ctx) { if (!ctx) return; @@ -52,7 +52,7 @@ fz_free_context(fz_context *ctx) fz_drop_document_handler_context(ctx); fz_drop_glyph_cache_context(ctx); fz_drop_store_context(ctx); - fz_free_aa_context(ctx); + fz_drop_aa_context(ctx); fz_drop_colorspace_context(ctx); fz_drop_font_context(ctx); fz_drop_id_context(ctx); @@ -117,7 +117,7 @@ new_context_phase1(fz_alloc_context *alloc, fz_locks_context *locks) cleanup: fprintf(stderr, "cannot create context (phase 1)\n"); - fz_free_context(ctx); + fz_drop_context(ctx); return NULL; } @@ -155,7 +155,7 @@ fz_new_context_imp(fz_alloc_context *alloc, fz_locks_context *locks, unsigned in fz_catch(ctx) { fprintf(stderr, "cannot create context (phase 2)\n"); - fz_free_context(ctx); + fz_drop_context(ctx); return NULL; } return ctx; diff --git a/source/fitz/device.c b/source/fitz/device.c index a13cd470..cb57256e 100644 --- a/source/fitz/device.c +++ b/source/fitz/device.c @@ -13,12 +13,12 @@ fz_new_device(fz_context *ctx, void *user) } void -fz_free_device(fz_device *dev) +fz_drop_device(fz_device *dev) { if (dev == NULL) return; - if (dev->free_user) - dev->free_user(dev); + if (dev->drop_user) + dev->drop_user(dev); fz_free(dev->ctx, dev->container); fz_free(dev->ctx, dev); } diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index a8d745af..8701cd31 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -1753,7 +1753,7 @@ static fz_store_type fz_tile_store_type = }; static void -fz_free_tile_record_imp(fz_context *ctx, fz_storable *storable) +fz_drop_tile_record_imp(fz_context *ctx, fz_storable *storable) { tile_record *tr = (tile_record *)(void *)storable; @@ -1774,7 +1774,7 @@ static tile_record * fz_new_tile_record(fz_context *ctx, fz_pixmap *dest, fz_pixmap *shape) { tile_record *tile = fz_malloc_struct(ctx, tile_record); - FZ_INIT_STORABLE(tile, 1, fz_free_tile_record_imp); + FZ_INIT_STORABLE(tile, 1, fz_drop_tile_record_imp); tile->dest = fz_keep_pixmap(ctx, dest); tile->shape = fz_keep_pixmap(ctx, shape); return tile; @@ -1828,7 +1828,7 @@ fz_draw_begin_tile(fz_device *devp, const fz_rect *area, const fz_rect *view, fl tk.ctm[3] = ctm->d; tk.id = id; - tile = fz_find_item(ctx, fz_free_tile_record_imp, &tk, &fz_tile_store_type); + tile = fz_find_item(ctx, fz_drop_tile_record_imp, &tk, &fz_tile_store_type); if (tile) { state[1].dest = fz_keep_pixmap(ctx, tile->dest); @@ -2038,7 +2038,7 @@ fz_draw_end_tile(fz_device *devp) } static void -fz_draw_free_user(fz_device *devp) +fz_draw_drop_user(fz_device *devp) { fz_draw_device *dev = devp->user; fz_context *ctx = dev->ctx; @@ -2062,9 +2062,9 @@ fz_draw_free_user(fz_device *devp) */ if (dev->stack != &dev->init_stack[0]) fz_free(ctx, dev->stack); - fz_free_scale_cache(ctx, dev->cache_x); - fz_free_scale_cache(ctx, dev->cache_y); - fz_free_gel(dev->gel); + fz_drop_scale_cache(ctx, dev->cache_x); + fz_drop_scale_cache(ctx, dev->cache_y); + fz_drop_gel(dev->gel); fz_free(ctx, dev); } @@ -2098,13 +2098,13 @@ fz_new_draw_device(fz_context *ctx, fz_pixmap *dest) } fz_catch(ctx) { - fz_free_scale_cache(ctx, ddev->cache_x); - fz_free_scale_cache(ctx, ddev->cache_y); - fz_free_gel(ddev->gel); + fz_drop_scale_cache(ctx, ddev->cache_x); + fz_drop_scale_cache(ctx, ddev->cache_y); + fz_drop_gel(ddev->gel); fz_free(ctx, ddev); fz_rethrow(ctx); } - dev->free_user = fz_draw_free_user; + dev->drop_user = fz_draw_drop_user; dev->fill_path = fz_draw_fill_path; dev->stroke_path = fz_draw_stroke_path; @@ -2177,7 +2177,7 @@ fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor, else fz_flatten_fill_path(gel, path, ctm, flatness); fz_bound_gel(gel, bbox); - fz_free_gel(gel); + fz_drop_gel(gel); return bbox; } diff --git a/source/fitz/draw-edge.c b/source/fitz/draw-edge.c index c8d94155..e1fd5f37 100644 --- a/source/fitz/draw-edge.c +++ b/source/fitz/draw-edge.c @@ -48,7 +48,7 @@ void fz_copy_aa_context(fz_context *dst, fz_context *src) memcpy(dst->aa, src->aa, sizeof(*src->aa)); } -void fz_free_aa_context(fz_context *ctx) +void fz_drop_aa_context(fz_context *ctx) { #ifndef AA_BITS fz_free(ctx, ctx->aa); @@ -228,7 +228,7 @@ fz_reset_gel(fz_gel *gel, const fz_irect *clip) } void -fz_free_gel(fz_gel *gel) +fz_drop_gel(fz_gel *gel) { if (gel == NULL) return; diff --git a/source/fitz/draw-imp.h b/source/fitz/draw-imp.h index 9b9e50c0..b5f4690d 100644 --- a/source/fitz/draw-imp.h +++ b/source/fitz/draw-imp.h @@ -12,7 +12,7 @@ void fz_insert_gel(fz_gel *gel, float x0, float y0, float x1, float y1); void fz_reset_gel(fz_gel *gel, const fz_irect *clip); void fz_sort_gel(fz_gel *gel); fz_irect *fz_bound_gel(const fz_gel *gel, fz_irect *bbox); -void fz_free_gel(fz_gel *gel); +void fz_drop_gel(fz_gel *gel); int fz_is_rect_gel(fz_gel *gel); fz_rect *fz_gel_scissor(const fz_gel *gel, fz_rect *rect); diff --git a/source/fitz/draw-scale-simple.c b/source/fitz/draw-scale-simple.c index 939464a1..5651e1f4 100644 --- a/source/fitz/draw-scale-simple.c +++ b/source/fitz/draw-scale-simple.c @@ -1498,7 +1498,7 @@ cleanup: } void -fz_free_scale_cache(fz_context *ctx, fz_scale_cache *sc) +fz_drop_scale_cache(fz_context *ctx, fz_scale_cache *sc) { if (!sc) return; diff --git a/source/fitz/filter-basic.c b/source/fitz/filter-basic.c index 807364bc..1b4eaefb 100644 --- a/source/fitz/filter-basic.c +++ b/source/fitz/filter-basic.c @@ -50,7 +50,7 @@ close_null(fz_context *ctx, void *state_) struct null_filter *state = (struct null_filter *)state_; fz_stream *chain = state->chain; fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); } static fz_stream * @@ -77,7 +77,7 @@ fz_open_null(fz_stream *chain, int len, int offset) } fz_catch(ctx) { - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } @@ -123,7 +123,7 @@ next_concat(fz_stream *stm, int max) break; } state->current++; - fz_close(state->chain[state->current-1]); + fz_drop_stream(state->chain[state->current-1]); if (state->pad) { stm->rp = (&state->ws_buf)+1; @@ -147,7 +147,7 @@ close_concat(fz_context *ctx, void *state_) for (i = state->current; i < state->count; i++) { - fz_close(state->chain[i]); + fz_drop_stream(state->chain[i]); } fz_free(ctx, state); } @@ -293,7 +293,7 @@ close_ahxd(fz_context *ctx, void *state_) fz_ahxd *state = (fz_ahxd *)state_; fz_stream *chain = state->chain; fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); } static fz_stream * @@ -317,7 +317,7 @@ fz_open_ahxd(fz_stream *chain) } fz_catch(ctx) { - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } @@ -445,7 +445,7 @@ close_a85d(fz_context *ctx, void *state_) fz_stream *chain = state->chain; fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); } static fz_stream * @@ -469,7 +469,7 @@ fz_open_a85d(fz_stream *chain) } fz_catch(ctx) { - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } @@ -564,7 +564,7 @@ close_rld(fz_context *ctx, void *state_) fz_stream *chain = state->chain; fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); } static fz_stream * @@ -590,7 +590,7 @@ fz_open_rld(fz_stream *chain) } fz_catch(ctx) { - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } @@ -635,7 +635,7 @@ close_arc4(fz_context *ctx, void *state_) fz_stream *chain = state->chain; fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); } static fz_stream * @@ -659,7 +659,7 @@ fz_open_arc4(fz_stream *chain, unsigned char *key, unsigned keylen) } fz_catch(ctx) { - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } @@ -745,7 +745,7 @@ close_aesd(fz_context *ctx, void *state_) fz_stream *chain = state->chain; fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); } static fz_stream * @@ -776,7 +776,7 @@ fz_open_aesd(fz_stream *chain, unsigned char *key, unsigned keylen) fz_catch(ctx) { fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } diff --git a/source/fitz/filter-dct.c b/source/fitz/filter-dct.c index 344dbdbf..9495b899 100644 --- a/source/fitz/filter-dct.c +++ b/source/fitz/filter-dct.c @@ -308,8 +308,8 @@ skip: fz_dct_mem_term(state); fz_free(ctx, state->scanline); - fz_close(state->chain); - fz_close(state->jpegtables); + fz_drop_stream(state->chain); + fz_drop_stream(state->jpegtables); fz_free(ctx, state); } @@ -344,8 +344,8 @@ fz_open_dctd(fz_stream *chain, int color_transform, int l2factor, fz_stream *jpe fz_catch(ctx) { fz_free(ctx, state); - fz_close(chain); - fz_close(jpegtables); + fz_drop_stream(chain); + fz_drop_stream(jpegtables); fz_rethrow(ctx); } diff --git a/source/fitz/filter-fax.c b/source/fitz/filter-fax.c index 70692338..134c2ae5 100644 --- a/source/fitz/filter-fax.c +++ b/source/fitz/filter-fax.c @@ -778,7 +778,7 @@ close_faxd(fz_context *ctx, void *state_) while (i--) fz_unread_byte(fax->chain); - fz_close(fax->chain); + fz_drop_stream(fax->chain); fz_free(ctx, fax->ref); fz_free(ctx, fax->dst); fz_free(ctx, fax); @@ -848,7 +848,7 @@ fz_open_faxd(fz_stream *chain, fz_free(ctx, fax->ref); } fz_free(ctx, fax); - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } diff --git a/source/fitz/filter-flate.c b/source/fitz/filter-flate.c index b66661cc..764e819a 100644 --- a/source/fitz/filter-flate.c +++ b/source/fitz/filter-flate.c @@ -93,7 +93,7 @@ close_flated(fz_context *ctx, void *state_) if (code != Z_OK) fz_warn(ctx, "zlib error: inflateEnd: %s", state->z.msg); - fz_close(state->chain); + fz_drop_stream(state->chain); fz_free(ctx, state); } @@ -134,7 +134,7 @@ fz_open_flated(fz_stream *chain, int window_bits) if (state && code == Z_OK) inflateEnd(&state->z); fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } return fz_new_stream(ctx, state, next_flated, close_flated, rebind_flated); diff --git a/source/fitz/filter-jbig2.c b/source/fitz/filter-jbig2.c index 98919dcb..0e624da6 100644 --- a/source/fitz/filter-jbig2.c +++ b/source/fitz/filter-jbig2.c @@ -35,7 +35,7 @@ close_jbig2d(fz_context *ctx, void *state_) if (state->gctx) fz_drop_jbig2_globals(ctx, state->gctx); jbig2_ctx_free(state->ctx); - fz_close(state->chain); + fz_drop_stream(state->chain); fz_free(ctx, state); } @@ -112,14 +112,14 @@ fz_load_jbig2_globals(fz_context *ctx, unsigned char *data, int size) Jbig2Ctx *jctx = jbig2_ctx_new(NULL, JBIG2_OPTIONS_EMBEDDED, NULL, error_callback, ctx); jbig2_data_in(jctx, data, size); - FZ_INIT_STORABLE(globals, 1, fz_free_jbig2_globals_imp); + FZ_INIT_STORABLE(globals, 1, fz_drop_jbig2_globals_imp); globals->gctx = jbig2_make_global_ctx(jctx); return globals; } void -fz_free_jbig2_globals_imp(fz_context *ctx, fz_storable *globals_) +fz_drop_jbig2_globals_imp(fz_context *ctx, fz_storable *globals_) { fz_jbig2_globals *globals = (fz_jbig2_globals *)globals_; jbig2_global_ctx_free(globals->gctx); @@ -153,7 +153,7 @@ fz_open_jbig2d(fz_stream *chain, fz_jbig2_globals *globals) jbig2_ctx_free(state->ctx); } fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } diff --git a/source/fitz/filter-leech.c b/source/fitz/filter-leech.c index 321e31d7..67a43a29 100644 --- a/source/fitz/filter-leech.c +++ b/source/fitz/filter-leech.c @@ -40,7 +40,7 @@ close_leech(fz_context *ctx, void *state_) { fz_leech *state = (fz_leech *)state_; - fz_close(state->chain); + fz_drop_stream(state->chain); fz_free(ctx, state); } @@ -68,7 +68,7 @@ fz_open_leecher(fz_stream *chain, fz_buffer *buffer) fz_catch(ctx) { fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } return fz_new_stream(ctx, state, next_leech, close_leech, rebind_leech); diff --git a/source/fitz/filter-lzw.c b/source/fitz/filter-lzw.c index 16b5253a..4f8fdd31 100644 --- a/source/fitz/filter-lzw.c +++ b/source/fitz/filter-lzw.c @@ -189,7 +189,7 @@ close_lzwd(fz_context *ctx, void *state_) { fz_lzwd *lzw = (fz_lzwd *)state_; fz_sync_bits(lzw->chain); - fz_close(lzw->chain); + fz_drop_stream(lzw->chain); fz_free(ctx, lzw); } @@ -243,7 +243,7 @@ fz_open_lzwd(fz_stream *chain, int early_change) fz_catch(ctx) { fz_free(ctx, lzw); - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } diff --git a/source/fitz/filter-predict.c b/source/fitz/filter-predict.c index 3aaa6ee9..a5c93bfd 100644 --- a/source/fitz/filter-predict.c +++ b/source/fitz/filter-predict.c @@ -209,7 +209,7 @@ static void close_predict(fz_context *ctx, void *state_) { fz_predict *state = (fz_predict *)state_; - fz_close(state->chain); + fz_drop_stream(state->chain); fz_free(ctx, state->in); fz_free(ctx, state->out); fz_free(ctx, state->ref); @@ -288,7 +288,7 @@ fz_open_predict(fz_stream *chain, int predictor, int columns, int colors, int bp fz_free(ctx, state->out); } fz_free(ctx, state); - fz_close(chain); + fz_drop_stream(chain); fz_rethrow(ctx); } diff --git a/source/fitz/font.c b/source/fitz/font.c index 598931e8..08379b0f 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -1065,7 +1065,7 @@ fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid, int nested_depth) FZ_DEVFLAG_LINEWIDTH_UNDEFINED; font->t3run(font->t3doc, font->t3resources, contents, dev, &fz_identity, NULL, 0); font->t3flags[gid] = dev->flags; - fz_free_device(dev); + fz_drop_device(dev); } static fz_rect * @@ -1091,7 +1091,7 @@ fz_bound_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, } fz_always(ctx) { - fz_free_device(dev); + fz_drop_device(dev); } fz_catch(ctx) { @@ -1168,7 +1168,7 @@ fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr } fz_always(ctx) { - fz_free_device(dev); + fz_drop_device(dev); } fz_catch(ctx) { diff --git a/source/fitz/glyph.c b/source/fitz/glyph.c index 0bf4c7fd..8e514751 100644 --- a/source/fitz/glyph.c +++ b/source/fitz/glyph.c @@ -15,7 +15,7 @@ fz_drop_glyph(fz_context *ctx, fz_glyph *glyph) } static void -fz_free_glyph_imp(fz_context *ctx, fz_storable *glyph_) +fz_drop_glyph_imp(fz_context *ctx, fz_storable *glyph_) { fz_glyph *glyph = (fz_glyph *)glyph_; @@ -136,7 +136,7 @@ fz_new_glyph_from_pixmap(fz_context *ctx, fz_pixmap *pix) if (pix->n != 1 || pix->w * pix->h < RLE_THRESHOLD) { glyph = fz_malloc_struct(ctx, fz_glyph); - FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp); + FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp); glyph->x = pix->x; glyph->y = pix->y; glyph->w = pix->w; @@ -181,7 +181,7 @@ fz_new_glyph_from_8bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigne size = h * w; fill = h * sizeof(int); glyph = fz_malloc(ctx, sizeof(fz_glyph) + size); - FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp); + FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp); glyph->x = x; glyph->y = y; glyph->w = w; @@ -288,7 +288,7 @@ fz_new_glyph_from_8bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigne * critical. */ try_pixmap: glyph = fz_resize_array(ctx, glyph, 1, sizeof(fz_glyph)); - FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp); + FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp); pix = fz_new_pixmap_from_8bpp_data(ctx, x, y, w, h, orig_sp, span); glyph->x = pix->x; glyph->y = pix->y; @@ -329,7 +329,7 @@ fz_new_glyph_from_1bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigne size = h * w; fill = h * sizeof(int); glyph = fz_malloc(ctx, sizeof(fz_glyph) + size); - FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp); + FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp); glyph->x = x; glyph->y = y; glyph->w = w; @@ -420,7 +420,7 @@ fz_new_glyph_from_1bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigne * critical. */ try_pixmap: glyph = fz_resize_array(ctx, glyph, 1, sizeof(fz_glyph)); - FZ_INIT_STORABLE(glyph, 1, fz_free_glyph_imp); + FZ_INIT_STORABLE(glyph, 1, fz_drop_glyph_imp); pix = fz_new_pixmap_from_1bpp_data(ctx, x, y, w, h, orig_sp, span); glyph->x = pix->x; glyph->y = pix->y; diff --git a/source/fitz/hash.c b/source/fitz/hash.c index 708d72f2..acd22334 100644 --- a/source/fitz/hash.c +++ b/source/fitz/hash.c @@ -94,7 +94,7 @@ fz_hash_get_val(fz_context *ctx, fz_hash_table *table, int idx) } void -fz_free_hash(fz_context *ctx, fz_hash_table *table) +fz_drop_hash(fz_context *ctx, fz_hash_table *table) { fz_free(ctx, table->ents); fz_free(ctx, table); diff --git a/source/fitz/image.c b/source/fitz/image.c index 09d39043..e7096ab4 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -216,7 +216,7 @@ fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, in } fz_always(ctx) { - fz_close(stm); + fz_drop_stream(stm); } fz_catch(ctx) { @@ -239,14 +239,14 @@ fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, in } void -fz_free_image(fz_context *ctx, fz_storable *image_) +fz_drop_image_imp(fz_context *ctx, fz_storable *image_) { fz_image *image = (fz_image *)image_; if (image == NULL) return; fz_drop_pixmap(ctx, image->tile); - fz_free_compressed_buffer(ctx, image->buffer); + fz_drop_compressed_buffer(ctx, image->buffer); fz_drop_colorspace(ctx, image->colorspace); fz_drop_image(ctx, image->mask); fz_free(ctx, image); @@ -293,7 +293,7 @@ fz_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h) key.l2factor = l2factor; do { - tile = fz_find_item(ctx, fz_free_pixmap_imp, &key, &fz_image_store_type); + tile = fz_find_item(ctx, fz_drop_pixmap_imp, &key, &fz_image_store_type); if (tile) return tile; key.l2factor--; @@ -393,7 +393,7 @@ fz_new_image_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, fz_image *mask) fz_try(ctx) { image = fz_malloc_struct(ctx, fz_image); - FZ_INIT_STORABLE(image, 1, fz_free_image); + FZ_INIT_STORABLE(image, 1, fz_drop_image_imp); image->w = pixmap->w; image->h = pixmap->h; image->n = pixmap->n; @@ -427,7 +427,7 @@ fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace, fz_try(ctx) { image = fz_malloc_struct(ctx, fz_image); - FZ_INIT_STORABLE(image, 1, fz_free_image); + FZ_INIT_STORABLE(image, 1, fz_drop_image_imp); image->get_pixmap = fz_image_get_pixmap; image->w = w; image->h = h; @@ -458,7 +458,7 @@ fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace, } fz_catch(ctx) { - fz_free_compressed_buffer(ctx, buffer); + fz_drop_compressed_buffer(ctx, buffer); fz_rethrow(ctx); } @@ -538,7 +538,7 @@ fz_new_image_from_buffer(fz_context *ctx, fz_buffer *buffer) } fz_catch(ctx) { - fz_free_compressed_buffer(ctx, bc); + fz_drop_compressed_buffer(ctx, bc); fz_rethrow(ctx); } diff --git a/source/fitz/link.c b/source/fitz/link.c index 30dca222..152d48ea 100644 --- a/source/fitz/link.c +++ b/source/fitz/link.c @@ -1,7 +1,7 @@ #include "mupdf/fitz.h" void -fz_free_link_dest(fz_context *ctx, fz_link_dest *dest) +fz_drop_link_dest(fz_context *ctx, fz_link_dest *dest) { switch (dest->kind) { @@ -35,7 +35,7 @@ fz_new_link(fz_context *ctx, const fz_rect *bbox, fz_link_dest dest) } fz_catch(ctx) { - fz_free_link_dest(ctx, &dest); + fz_drop_link_dest(ctx, &dest); fz_rethrow(ctx); } link->dest = dest; @@ -58,7 +58,7 @@ 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_drop_link_dest(ctx, &link->dest); fz_free(ctx, link); link = next; } diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c index 42590bab..c6e8011f 100644 --- a/source/fitz/list-device.c +++ b/source/fitz/list-device.c @@ -592,7 +592,7 @@ fz_new_list_device(fz_context *ctx, fz_display_list *list) } static void -fz_free_display_list(fz_context *ctx, fz_storable *list_) +fz_drop_display_list_imp(fz_context *ctx, fz_storable *list_) { fz_display_list *list = (fz_display_list *)list_; fz_display_node *node; @@ -613,7 +613,7 @@ fz_display_list * fz_new_display_list(fz_context *ctx) { fz_display_list *list = fz_malloc_struct(ctx, fz_display_list); - FZ_INIT_STORABLE(list, 1, fz_free_display_list); + FZ_INIT_STORABLE(list, 1, fz_drop_display_list_imp); list->first = NULL; list->last = NULL; list->len = 0; diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c index 671e5146..77fb816d 100644 --- a/source/fitz/load-tiff.c +++ b/source/fitz/load-tiff.c @@ -145,7 +145,7 @@ static void fz_decode_tiff_uncompressed(struct tiff *tiff, fz_stream *stm, unsigned char *wp, int wlen) { fz_read(stm, wp, wlen); - fz_close(stm); + fz_drop_stream(stm); } static void @@ -153,7 +153,7 @@ fz_decode_tiff_packbits(struct tiff *tiff, fz_stream *chain, unsigned char *wp, { fz_stream *stm = fz_open_rld(chain); fz_read(stm, wp, wlen); - fz_close(stm); + fz_drop_stream(stm); } static void @@ -161,7 +161,7 @@ fz_decode_tiff_lzw(struct tiff *tiff, fz_stream *chain, unsigned char *wp, int w { fz_stream *stm = fz_open_lzwd(chain, 1); fz_read(stm, wp, wlen); - fz_close(stm); + fz_drop_stream(stm); } static void @@ -169,7 +169,7 @@ fz_decode_tiff_flate(struct tiff *tiff, fz_stream *chain, unsigned char *wp, int { fz_stream *stm = fz_open_flated(chain, 15); fz_read(stm, wp, wlen); - fz_close(stm); + fz_drop_stream(stm); } static void @@ -183,7 +183,7 @@ fz_decode_tiff_fax(struct tiff *tiff, int comp, fz_stream *chain, unsigned char k, 0, encoded_byte_align, tiff->imagewidth, tiff->imagelength, 0, black_is_1); fz_read(stm, wp, wlen); - fz_close(stm); + fz_drop_stream(stm); } static void @@ -198,7 +198,7 @@ fz_decode_tiff_jpeg(struct tiff *tiff, fz_stream *chain, unsigned char *wp, int color_transform = 0; stm = fz_open_dctd(chain, color_transform, 0, jpegtables); fz_read(stm, wp, wlen); - fz_close(stm); + fz_drop_stream(stm); } static inline int getcomp(unsigned char *line, int x, int bpc) diff --git a/source/fitz/outline.c b/source/fitz/outline.c index e26fd378..7a019883 100644 --- a/source/fitz/outline.c +++ b/source/fitz/outline.c @@ -1,14 +1,14 @@ #include "mupdf/fitz.h" void -fz_free_outline(fz_context *ctx, fz_outline *outline) +fz_drop_outline(fz_context *ctx, fz_outline *outline) { while (outline) { fz_outline *next = outline->next; - fz_free_outline(ctx, outline->down); + fz_drop_outline(ctx, outline->down); fz_free(ctx, outline->title); - fz_free_link_dest(ctx, &outline->dest); + fz_drop_link_dest(ctx, &outline->dest); fz_free(ctx, outline); outline = next; } diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c index 0eeab8d3..90695eb7 100644 --- a/source/fitz/output-pcl.c +++ b/source/fitz/output-pcl.c @@ -816,7 +816,7 @@ fz_write_pcl(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, fz_ } fz_always(ctx) { - fz_close_output(out); + fz_drop_output(out); fclose(fp); } fz_catch(ctx) @@ -846,7 +846,7 @@ fz_write_pcl_bitmap(fz_context *ctx, fz_bitmap *bitmap, char *filename, int appe } fz_always(ctx) { - fz_close_output(out); + fz_drop_output(out); fclose(fp); } fz_catch(ctx) diff --git a/source/fitz/output-pwg.c b/source/fitz/output-pwg.c index c6d1a0b5..a2107db6 100644 --- a/source/fitz/output-pwg.c +++ b/source/fitz/output-pwg.c @@ -283,7 +283,7 @@ fz_write_pwg(fz_context *ctx, fz_pixmap *pixmap, char *filename, int append, con } fz_always(ctx) { - fz_close_output(out); + fz_drop_output(out); fclose(fp); } fz_catch(ctx) @@ -315,7 +315,7 @@ fz_write_pwg_bitmap(fz_context *ctx, fz_bitmap *bitmap, char *filename, int appe } fz_always(ctx) { - fz_close_output(out); + fz_drop_output(out); fclose(fp); } fz_catch(ctx) diff --git a/source/fitz/output.c b/source/fitz/output.c index fe63de92..8f5a4a0f 100644 --- a/source/fitz/output.c +++ b/source/fitz/output.c @@ -71,7 +71,7 @@ fz_new_output_to_filename(fz_context *ctx, const char *filename) } void -fz_close_output(fz_output *out) +fz_drop_output(fz_output *out) { if (!out) return; diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c index 9ce8ffba..d6a74ea1 100644 --- a/source/fitz/pixmap.c +++ b/source/fitz/pixmap.c @@ -13,7 +13,7 @@ fz_drop_pixmap(fz_context *ctx, fz_pixmap *pix) } void -fz_free_pixmap_imp(fz_context *ctx, fz_storable *pix_) +fz_drop_pixmap_imp(fz_context *ctx, fz_storable *pix_) { fz_pixmap *pix = (fz_pixmap *)pix_; @@ -33,7 +33,7 @@ fz_new_pixmap_with_data(fz_context *ctx, fz_colorspace *colorspace, int w, int h fz_throw(ctx, FZ_ERROR_GENERIC, "Illegal dimensions for pixmap %d %d", w, h); pix = fz_malloc_struct(ctx, fz_pixmap); - FZ_INIT_STORABLE(pix, 1, fz_free_pixmap_imp); + FZ_INIT_STORABLE(pix, 1, fz_drop_pixmap_imp); pix->x = 0; pix->y = 0; pix->w = w; @@ -583,7 +583,7 @@ fz_write_pnm(fz_context *ctx, fz_pixmap *pixmap, char *filename) fz_output *out = fz_new_output_to_filename(ctx, filename); fz_output_pnm_header(out, pixmap->w, pixmap->h, pixmap->n); fz_output_pnm_band(out, pixmap->w, pixmap->h, pixmap->n, 0, pixmap->h, pixmap->samples); - fz_close_output(out); + fz_drop_output(out); } /* @@ -645,7 +645,7 @@ fz_write_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha) fz_output *out = fz_new_output_to_filename(ctx, filename); fz_output_pam_header(out, pixmap->w, pixmap->h, pixmap->n, savealpha); fz_output_pam_band(out, pixmap->w, pixmap->h, pixmap->n, 0, pixmap->h, pixmap->samples, savealpha); - fz_close_output(out); + fz_drop_output(out); } /* @@ -690,7 +690,7 @@ fz_write_png(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha) fz_always(ctx) { fz_output_png_trailer(out, poc); - fz_close_output(out); + fz_drop_output(out); } fz_catch(ctx) { @@ -929,7 +929,7 @@ png_from_pixmap(fz_context *ctx, fz_pixmap *pix, int drop) fz_always(ctx) { fz_drop_pixmap(ctx, drop ? pix : pix2); - fz_close_output(out); + fz_drop_output(out); } fz_catch(ctx) { @@ -1029,7 +1029,7 @@ fz_write_tga(fz_context *ctx, fz_pixmap *pixmap, const char *filename, int savea } fz_write(out, "\0\0\0\0\0\0\0\0TRUEVISION-XFILE.\0", 26); - fz_close_output(out); + fz_drop_output(out); } unsigned int diff --git a/source/fitz/shade.c b/source/fitz/shade.c index 4c6b1472..01ada9a4 100644 --- a/source/fitz/shade.c +++ b/source/fitz/shade.c @@ -362,7 +362,7 @@ fz_process_mesh_type4(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz } fz_always(ctx) { - fz_close(stream); + fz_drop_stream(stream); } fz_catch(ctx) { @@ -422,7 +422,7 @@ fz_process_mesh_type5(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz { fz_free(ctx, ref); fz_free(ctx, buf); - fz_close(stream); + fz_drop_stream(stream); } fz_catch(ctx) { @@ -790,7 +790,7 @@ fz_process_mesh_type6(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz } fz_always(ctx) { - fz_close(stream); + fz_drop_stream(stream); } fz_catch(ctx) { @@ -903,7 +903,7 @@ fz_process_mesh_type7(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz } fz_always(ctx) { - fz_close(stream); + fz_drop_stream(stream); } fz_catch(ctx) { @@ -1043,7 +1043,7 @@ fz_keep_shade(fz_context *ctx, fz_shade *shade) } void -fz_free_shade_imp(fz_context *ctx, fz_storable *shade_) +fz_drop_shade_imp(fz_context *ctx, fz_storable *shade_) { fz_shade *shade = (fz_shade *)shade_; @@ -1051,7 +1051,7 @@ fz_free_shade_imp(fz_context *ctx, fz_storable *shade_) fz_drop_colorspace(ctx, shade->colorspace); if (shade->type == FZ_FUNCTION_BASED) fz_free(ctx, shade->u.f.fn_vals); - fz_free_compressed_buffer(ctx, shade->buffer); + fz_drop_compressed_buffer(ctx, shade->buffer); fz_free(ctx, shade); } diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c index 20e5e525..f963eb19 100644 --- a/source/fitz/stext-device.c +++ b/source/fitz/stext-device.c @@ -368,7 +368,7 @@ fz_new_text_sheet(fz_context *ctx) } void -fz_free_text_sheet(fz_context *ctx, fz_text_sheet *sheet) +fz_drop_text_sheet(fz_context *ctx, fz_text_sheet *sheet) { fz_text_style *style; @@ -447,7 +447,7 @@ fz_new_text_page(fz_context *ctx) } static void -fz_free_text_line_contents(fz_context *ctx, fz_text_line *line) +fz_drop_text_line_contents(fz_context *ctx, fz_text_line *line) { fz_text_span *span, *next; for (span = line->first_span; span; span=next) @@ -459,19 +459,19 @@ fz_free_text_line_contents(fz_context *ctx, fz_text_line *line) } static void -fz_free_text_block(fz_context *ctx, fz_text_block *block) +fz_drop_text_block(fz_context *ctx, fz_text_block *block) { fz_text_line *line; if (block == NULL) return; for (line = block->lines; line < block->lines + block->len; line++) - fz_free_text_line_contents(ctx, line); + fz_drop_text_line_contents(ctx, line); fz_free(ctx, block->lines); fz_free(ctx, block); } static void -fz_free_image_block(fz_context *ctx, fz_image_block *block) +fz_drop_image_block(fz_context *ctx, fz_image_block *block) { if (block == NULL) return; @@ -481,7 +481,7 @@ fz_free_image_block(fz_context *ctx, fz_image_block *block) } void -fz_free_text_page(fz_context *ctx, fz_text_page *page) +fz_drop_text_page(fz_context *ctx, fz_text_page *page) { fz_page_block *block; if (page == NULL) @@ -491,10 +491,10 @@ fz_free_text_page(fz_context *ctx, fz_text_page *page) switch (block->type) { case FZ_PAGE_BLOCK_TEXT: - fz_free_text_block(ctx, block->u.text); + fz_drop_text_block(ctx, block->u.text); break; case FZ_PAGE_BLOCK_IMAGE: - fz_free_image_block(ctx, block->u.image); + fz_drop_image_block(ctx, block->u.image); break; } } @@ -994,7 +994,7 @@ fz_text_end_page(fz_device *dev) } static void -fz_text_free_user(fz_device *dev) +fz_text_drop_user(fz_device *dev) { fz_text_device *tdev = dev->user; free_span_soup(tdev->spans); @@ -1017,7 +1017,7 @@ fz_new_text_device(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page) dev->hints = FZ_IGNORE_IMAGE | FZ_IGNORE_SHADE; dev->begin_page = fz_text_begin_page; dev->end_page = fz_text_end_page; - dev->free_user = fz_text_free_user; + dev->drop_user = fz_text_drop_user; dev->fill_text = fz_text_fill_text; dev->stroke_text = fz_text_stroke_text; dev->clip_text = fz_text_clip_text; diff --git a/source/fitz/store.c b/source/fitz/store.c index cf0e3536..315f8e81 100644 --- a/source/fitz/store.c +++ b/source/fitz/store.c @@ -88,7 +88,7 @@ fz_drop_storable(fz_context *ctx, fz_storable *s) } fz_unlock(ctx, FZ_LOCK_ALLOC); if (do_free) - s->free(ctx, s); + s->drop(ctx, s); } static void @@ -113,14 +113,14 @@ evict(fz_context *ctx, fz_item *item) if (item->type->make_hash_key) { fz_store_hash hash = { NULL }; - hash.free = item->val->free; + hash.drop = item->val->drop; if (item->type->make_hash_key(&hash, item->key)) fz_hash_remove(ctx, store->hash, &hash); } fz_unlock(ctx, FZ_LOCK_ALLOC); if (drop) - item->val->free(ctx, item->val); - /* Always drops the key and free the item */ + item->val->drop(ctx, item->val); + /* Always drops the key and drop the item */ item->type->drop_key(ctx, item->key); fz_free(ctx, item); fz_lock(ctx, FZ_LOCK_ALLOC); @@ -250,7 +250,7 @@ fz_store_item(fz_context *ctx, void *key, void *val_, unsigned int itemsize, fz_ if (type->make_hash_key) { - hash.free = val->free; + hash.drop = val->drop; use_hash = type->make_hash_key(&hash, key); } @@ -347,7 +347,7 @@ fz_store_item(fz_context *ctx, void *key, void *val_, unsigned int itemsize, fz_ } void * -fz_find_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type *type) +fz_find_item(fz_context *ctx, fz_store_drop_fn *drop, void *key, fz_store_type *type) { fz_item *item; fz_store *store = ctx->store; @@ -362,7 +362,7 @@ fz_find_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type * if (type->make_hash_key) { - hash.free = free; + hash.drop = drop; use_hash = type->make_hash_key(&hash, key); } @@ -377,7 +377,7 @@ fz_find_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type * /* Others we have to hunt for slowly */ for (item = store->head; item; item = item->next) { - if (item->val->free == free && !type->cmp_key(item->key, key)) + if (item->val->drop == drop && !type->cmp_key(item->key, key)) break; } } @@ -400,17 +400,17 @@ fz_find_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type * } void -fz_remove_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type *type) +fz_remove_item(fz_context *ctx, fz_store_drop_fn *drop, void *key, fz_store_type *type) { fz_item *item; fz_store *store = ctx->store; - int drop; + int dodrop; fz_store_hash hash = { NULL }; int use_hash = 0; if (type->make_hash_key) { - hash.free = free; + hash.drop = drop; use_hash = type->make_hash_key(&hash, key); } @@ -426,7 +426,7 @@ fz_remove_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type { /* Others we have to hunt for slowly */ for (item = store->head; item; item = item->next) - if (item->val->free == free && !type->cmp_key(item->key, key)) + if (item->val->drop == drop && !type->cmp_key(item->key, key)) break; } if (item) @@ -445,10 +445,10 @@ fz_remove_item(fz_context *ctx, fz_store_free_fn *free, void *key, fz_store_type else store->head = item->next; } - drop = (item->val->refs > 0 && --item->val->refs == 0); + dodrop = (item->val->refs > 0 && --item->val->refs == 0); fz_unlock(ctx, FZ_LOCK_ALLOC); - if (drop) - item->val->free(ctx, item->val); + if (dodrop) + item->val->drop(ctx, item->val); type->drop_key(ctx, item->key); fz_free(ctx, item); } @@ -497,7 +497,7 @@ fz_drop_store_context(fz_context *ctx) return; fz_empty_store(ctx); - fz_free_hash(ctx, ctx->store->hash); + fz_drop_hash(ctx, ctx->store->hash); fz_free(ctx, ctx->store); ctx->store = NULL; } diff --git a/source/fitz/stream-open.c b/source/fitz/stream-open.c index 3e51e733..c5808a73 100644 --- a/source/fitz/stream-open.c +++ b/source/fitz/stream-open.c @@ -58,7 +58,7 @@ fz_keep_stream(fz_stream *stm) } void -fz_close(fz_stream *stm) +fz_drop_stream(fz_stream *stm) { if (!stm) return; diff --git a/source/fitz/stream-read.c b/source/fitz/stream-read.c index 3144974e..49e1c1a3 100644 --- a/source/fitz/stream-read.c +++ b/source/fitz/stream-read.c @@ -177,7 +177,7 @@ fz_read_file(fz_context *ctx, const char *filename) } fz_always(ctx) { - fz_close(stm); + fz_drop_stream(stm); } fz_catch(ctx) { diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index f90557b5..b4e10fe4 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -1027,7 +1027,7 @@ svg_dev_end_tile(fz_device *dev) } static void -svg_dev_free_user(fz_device *dev) +svg_dev_drop_user(fz_device *dev) { svg_device *sdev = dev->user; fz_context *ctx = sdev->ctx; @@ -1035,7 +1035,7 @@ svg_dev_free_user(fz_device *dev) fz_free(ctx, sdev->tiles); fz_drop_buffer(ctx, sdev->defs_buffer); - fz_close_output(sdev->defs); + fz_drop_output(sdev->defs); fz_printf(out, "</svg>\n"); @@ -1072,7 +1072,7 @@ fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, } dev->rebind = svg_rebind; - dev->free_user = svg_dev_free_user; + dev->drop_user = svg_dev_drop_user; dev->fill_path = svg_dev_fill_path; dev->stroke_path = svg_dev_stroke_path; diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c index 9c778ce1..919bda98 100644 --- a/source/fitz/test-device.c +++ b/source/fitz/test-device.c @@ -152,7 +152,7 @@ fz_test_fill_image(fz_device *dev, fz_image *image, const fz_matrix *ctm, float { *t->is_color = 1; dev->hints |= FZ_IGNORE_IMAGE; - fz_close(stream); + fz_drop_stream(stream); fz_throw(ctx, FZ_ERROR_ABORT, "Page found as color; stopping interpretation"); break; } @@ -183,7 +183,7 @@ fz_test_fill_image(fz_device *dev, fz_image *image, const fz_matrix *ctm, float } fz_fin_cached_color_converter(&cc); } - fz_close(stream); + fz_drop_stream(stream); return; } @@ -287,7 +287,7 @@ fz_new_test_device(fz_context *ctx, int *is_color, float threshold) dev->fill_shade = fz_test_fill_shade; dev->fill_image = fz_test_fill_image; dev->fill_image_mask = fz_test_fill_image_mask; - dev->free_user = fz_test_free; + dev->drop_user = fz_test_free; *t->is_color = 0; diff --git a/source/fitz/tree.c b/source/fitz/tree.c index ca94a45b..18fb6548 100644 --- a/source/fitz/tree.c +++ b/source/fitz/tree.c @@ -89,17 +89,17 @@ fz_tree *fz_tree_insert(fz_context *ctx, fz_tree *node, const char *key, void *v } } -void fz_free_tree(fz_context *ctx, fz_tree *node, void (*freefunc)(fz_context *ctx, void *value)) +void fz_drop_tree(fz_context *ctx, fz_tree *node, void (*dropfunc)(fz_context *ctx, void *value)) { if (node) { if (node->left != &sentinel) - fz_free_tree(ctx, node->left, freefunc); + fz_drop_tree(ctx, node->left, dropfunc); if (node->right != &sentinel) - fz_free_tree(ctx, node->right, freefunc); + fz_drop_tree(ctx, node->right, dropfunc); fz_free(ctx, node->key); - if (freefunc) - freefunc(ctx, node->value); + if (dropfunc) + dropfunc(ctx, node->value); } } diff --git a/source/fitz/unzip.c b/source/fitz/unzip.c index f13a9ace..bafc4146 100644 --- a/source/fitz/unzip.c +++ b/source/fitz/unzip.c @@ -452,13 +452,13 @@ fz_list_archive_entry(fz_context *ctx, fz_archive *zip, int idx) } void -fz_close_archive(fz_context *ctx, fz_archive *zip) +fz_drop_archive(fz_context *ctx, fz_archive *zip) { int i; if (zip) { fz_free(ctx, zip->directory); - fz_close(zip->file); + fz_drop_stream(zip->file); for (i = 0; i < zip->count; ++i) fz_free(ctx, zip->table[i].name); fz_free(ctx, zip->table); @@ -497,7 +497,7 @@ fz_open_archive_with_stream(fz_context *ctx, fz_stream *file) } fz_catch(ctx) { - fz_close_archive(ctx, zip); + fz_drop_archive(ctx, zip); fz_rethrow(ctx); } @@ -517,7 +517,7 @@ fz_open_archive(fz_context *ctx, const char *filename) } fz_always(ctx) { - fz_close(file); + fz_drop_stream(file); } fz_catch(ctx) { diff --git a/source/fitz/xml.c b/source/fitz/xml.c index 0d370331..424a6bdf 100644 --- a/source/fitz/xml.c +++ b/source/fitz/xml.c @@ -205,7 +205,7 @@ static void xml_free_attribute(fz_context *ctx, struct attribute *att) } } -void fz_free_xml(fz_context *ctx, fz_xml *item) +void fz_drop_xml(fz_context *ctx, fz_xml *item) { while (item) { @@ -215,7 +215,7 @@ void fz_free_xml(fz_context *ctx, fz_xml *item) if (item->atts) xml_free_attribute(ctx, item->atts); if (item->down) - fz_free_xml(ctx, item->down); + fz_drop_xml(ctx, item->down); fz_free(ctx, item); item = next; } @@ -618,7 +618,7 @@ fz_parse_xml(fz_context *ctx, unsigned char *s, int n, int preserve_white) } fz_catch(ctx) { - fz_free_xml(ctx, root.down); + fz_drop_xml(ctx, root.down); fz_rethrow(ctx); } |