diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2015-11-09 14:17:00 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2015-12-11 12:11:31 +0100 |
commit | c22e6a6dc2bf6acbac955bd5fbdd896329dfd725 (patch) | |
tree | d9d84d3a6a74ed74c9d470b532097769545e8dc6 /source/fitz/store.c | |
parent | 95b928431f233052e4bbbd1b2bf9fc705657b5a7 (diff) | |
download | mupdf-c22e6a6dc2bf6acbac955bd5fbdd896329dfd725.tar.xz |
Use fz_output instead of FILE* for most of our output needs.
Use fz_output in debug printing functions.
Use fz_output in pdfshow.
Use fz_output in fz_trace_device instead of stdout.
Use fz_output in pdf-write.c.
Rename fz_new_output_to_filename to fz_new_output_with_path.
Add seek and tell to fz_output.
Remove unused functions like fz_fprintf.
Fix typo in pdf_print_obj.
Diffstat (limited to 'source/fitz/store.c')
-rw-r--r-- | source/fitz/store.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/source/fitz/store.c b/source/fitz/store.c index ce83e87f..4bb54c19 100644 --- a/source/fitz/store.c +++ b/source/fitz/store.c @@ -484,52 +484,46 @@ fz_drop_store_context(fz_context *ctx) ctx->store = NULL; } -#ifndef NDEBUG static void -print_item(FILE *out, void *item_) +print_item(fz_context *ctx, fz_output *out, void *item_) { fz_item *item = (fz_item *)item_; - fprintf(out, " val=%p item=%p\n", item->val, item); - fflush(out); + fz_printf(ctx, out, " val=%p item=%p\n", item->val, item); } void -fz_print_store_locked(fz_context *ctx, FILE *out) +fz_print_store_locked(fz_context *ctx, fz_output *out) { fz_item *item, *next; fz_store *store = ctx->store; - fprintf(out, "-- resource store contents --\n"); - fflush(out); + fz_printf(ctx, out, "-- resource store contents --\n"); for (item = store->head; item; item = next) { next = item->next; if (next) next->val->refs++; - fprintf(out, "store[*][refs=%d][size=%d] ", item->val->refs, item->size); + fz_printf(ctx, out, "store[*][refs=%d][size=%d] ", item->val->refs, item->size); fz_unlock(ctx, FZ_LOCK_ALLOC); - item->type->debug(ctx, out, item->key); - fprintf(out, " = %p\n", item->val); - fflush(out); + item->type->print(ctx, out, item->key); + fz_printf(ctx, out, " = %p\n", item->val); fz_lock(ctx, FZ_LOCK_ALLOC); if (next) next->val->refs--; } - fprintf(out, "-- resource store hash contents --\n"); + fz_printf(ctx, out, "-- resource store hash contents --\n"); fz_print_hash_details(ctx, out, store->hash, print_item); - fprintf(out, "-- end --\n"); - fflush(out); + fz_printf(ctx, out, "-- end --\n"); } void -fz_print_store(fz_context *ctx, FILE *out) +fz_print_store(fz_context *ctx, fz_output *out) { fz_lock(ctx, FZ_LOCK_ALLOC); fz_print_store_locked(ctx, out); fz_unlock(ctx, FZ_LOCK_ALLOC); } -#endif /* This is now an n^2 algorithm - not ideal, but it'll only be bad if we are * actually managing to scavenge lots of blocks back. */ |