From 82af5a75f9b36f2a427fece2cbd14686e644d4ec Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Wed, 4 Jul 2012 23:17:15 +0200 Subject: Remove debugging functions for release builds. --- fitz/base_hash.c | 2 ++ fitz/fitz-internal.h | 35 +++++++++++++++++++++++++---------- fitz/res_font.c | 2 ++ fitz/res_path.c | 2 ++ fitz/res_shade.c | 2 ++ fitz/res_store.c | 2 ++ pdf/mupdf-internal.h | 14 ++++++++++++-- pdf/mupdf.h | 3 +++ pdf/pdf_cmap.c | 2 ++ pdf/pdf_crypt.c | 2 ++ pdf/pdf_font.c | 2 ++ pdf/pdf_function.c | 4 ++++ pdf/pdf_image.c | 4 ++++ pdf/pdf_object.c | 2 ++ pdf/pdf_store.c | 4 ++++ pdf/pdf_xref.c | 2 ++ 16 files changed, 72 insertions(+), 12 deletions(-) diff --git a/fitz/base_hash.c b/fitz/base_hash.c index ccdffe63..76d7f870 100644 --- a/fitz/base_hash.c +++ b/fitz/base_hash.c @@ -267,6 +267,7 @@ fz_hash_remove(fz_context *ctx, fz_hash_table *table, void *key) } } +#ifndef NDEBUG void fz_print_hash(fz_context *ctx, FILE *out, fz_hash_table *table) { @@ -287,3 +288,4 @@ fz_print_hash(fz_context *ctx, FILE *out, fz_hash_table *table) } } } +#endif diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h index 6fc40f49..d352a94b 100644 --- a/fitz/fitz-internal.h +++ b/fitz/fitz-internal.h @@ -71,7 +71,6 @@ float fz_atof(const char *s); typedef struct fz_hash_table_s fz_hash_table; fz_hash_table *fz_new_hash_table(fz_context *ctx, int initialsize, int keylen, int lock); -void fz_print_hash(fz_context *ctx, FILE *out, fz_hash_table *table); void fz_empty_hash(fz_context *ctx, fz_hash_table *table); void fz_free_hash(fz_context *ctx, fz_hash_table *table); @@ -83,6 +82,10 @@ int fz_hash_len(fz_context *ctx, fz_hash_table *table); void *fz_hash_get_key(fz_context *ctx, fz_hash_table *table, int idx); void *fz_hash_get_val(fz_context *ctx, fz_hash_table *table, int idx); +#ifndef NDEBUG +void fz_print_hash(fz_context *ctx, FILE *out, fz_hash_table *table); +#endif + /* * Math and geometry */ @@ -270,7 +273,9 @@ struct fz_store_type_s void *(*keep_key)(fz_context *,void *); void (*drop_key)(fz_context *,void *); int (*cmp_key)(void *, void *); +#ifndef NDEBUG void (*debug)(void *); +#endif }; /* @@ -291,11 +296,6 @@ void fz_drop_store_context(fz_context *ctx); */ fz_store *fz_keep_store_context(fz_context *ctx); -/* - fz_print_store: Dump the contents of the store for debugging. -*/ -void fz_print_store(fz_context *ctx, FILE *out); - /* fz_store_item: Add an item to the store. @@ -364,6 +364,13 @@ void fz_empty_store(fz_context *ctx); */ int fz_store_scavenge(fz_context *ctx, unsigned int size, int *phase); +/* + fz_print_store: Dump the contents of the store for debugging. +*/ +#ifndef NDEBUG +void fz_print_store(fz_context *ctx, FILE *out); +#endif + struct fz_buffer_s { int refs; @@ -731,12 +738,14 @@ fz_font *fz_new_font_from_file(fz_context *ctx, char *path, int index, int use_g fz_font *fz_keep_font(fz_context *ctx, fz_font *font); void fz_drop_font(fz_context *ctx, fz_font *font); -void fz_print_font(fz_context *ctx, FILE *out, fz_font *font); - void fz_set_font_bbox(fz_context *ctx, fz_font *font, float xmin, float ymin, float xmax, float ymax); fz_rect fz_bound_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm); int fz_glyph_cacheable(fz_context *ctx, fz_font *font, int gid); +#ifndef NDEBUG +void fz_print_font(fz_context *ctx, FILE *out, fz_font *font); +#endif + /* * Vector path buffer. * It can be stroked and dashed, or be filled. @@ -815,7 +824,6 @@ fz_path *fz_clone_path(fz_context *ctx, fz_path *old); fz_rect fz_bound_path(fz_context *ctx, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm); void fz_adjust_rect_for_stroke(fz_rect *r, fz_stroke_state *stroke, fz_matrix *ctm); -void fz_print_path(fz_context *ctx, FILE *out, fz_path *, int indent); fz_stroke_state *fz_new_stroke_state(fz_context *ctx); fz_stroke_state *fz_new_stroke_state_with_len(fz_context *ctx, int len); @@ -824,6 +832,10 @@ void fz_drop_stroke_state(fz_context *ctx, fz_stroke_state *stroke); fz_stroke_state *fz_unshare_stroke_state(fz_context *ctx, fz_stroke_state *shared); fz_stroke_state *fz_unshare_stroke_state_with_len(fz_context *ctx, fz_stroke_state *shared, int len); +#ifndef NDEBUG +void fz_print_path(fz_context *ctx, FILE *out, fz_path *, int indent); +#endif + /* * Glyph cache */ @@ -916,11 +928,14 @@ struct fz_shade_s fz_shade *fz_keep_shade(fz_context *ctx, fz_shade *shade); void fz_drop_shade(fz_context *ctx, fz_shade *shade); void fz_free_shade_imp(fz_context *ctx, fz_storable *shade); -void fz_print_shade(fz_context *ctx, FILE *out, fz_shade *shade); fz_rect fz_bound_shade(fz_context *ctx, fz_shade *shade, fz_matrix ctm); void fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_matrix ctm, fz_pixmap *dest, fz_bbox bbox); +#ifndef NDEBUG +void fz_print_shade(fz_context *ctx, FILE *out, fz_shade *shade); +#endif + /* * Scan converter */ diff --git a/fitz/res_font.c b/fitz/res_font.c index 25939d02..0852c56b 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -813,6 +813,7 @@ fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, int gi /* RJW: "cannot draw type3 glyph" */ } +#ifndef NDEBUG void fz_print_font(fz_context *ctx, FILE *out, fz_font *font) { @@ -838,6 +839,7 @@ fz_print_font(fz_context *ctx, FILE *out, fz_font *font) fprintf(out, "}\n"); } +#endif fz_rect fz_bound_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm) diff --git a/fitz/res_path.c b/fitz/res_path.c index b8a6a1a2..7b429c43 100644 --- a/fitz/res_path.c +++ b/fitz/res_path.c @@ -336,6 +336,7 @@ fz_transform_path(fz_context *ctx, fz_path *path, fz_matrix ctm) } } +#ifndef NDEBUG void fz_print_path(fz_context *ctx, FILE *out, fz_path *path, int indent) { @@ -375,6 +376,7 @@ fz_print_path(fz_context *ctx, FILE *out, fz_path *path, int indent) } } } +#endif fz_stroke_state * fz_keep_stroke_state(fz_context *ctx, fz_stroke_state *stroke) diff --git a/fitz/res_shade.c b/fitz/res_shade.c index d2b2f44b..9ebdd51e 100644 --- a/fitz/res_shade.c +++ b/fitz/res_shade.c @@ -67,6 +67,7 @@ fz_bound_shade(fz_context *ctx, fz_shade *shade, fz_matrix ctm) return fz_intersect_rect(s, r); } +#ifndef NDEBUG void fz_print_shade(fz_context *ctx, FILE *out, fz_shade *shade) { @@ -130,3 +131,4 @@ fz_print_shade(fz_context *ctx, FILE *out, fz_shade *shade) fprintf(out, "}\n"); } +#endif diff --git a/fitz/res_store.c b/fitz/res_store.c index 8e5375d6..a76cfbb0 100644 --- a/fitz/res_store.c +++ b/fitz/res_store.c @@ -452,6 +452,7 @@ fz_drop_store_context(fz_context *ctx) ctx->store = NULL; } +#ifndef NDEBUG void fz_print_store(fz_context *ctx, FILE *out) { @@ -476,6 +477,7 @@ fz_print_store(fz_context *ctx, FILE *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. */ diff --git a/pdf/mupdf-internal.h b/pdf/mupdf-internal.h index b2097691..b7fc4291 100644 --- a/pdf/mupdf-internal.h +++ b/pdf/mupdf-internal.h @@ -222,10 +222,13 @@ fz_stream *pdf_open_raw_renumbered_stream(pdf_document *doc, int num, int gen, i void pdf_repair_xref(pdf_document *doc, pdf_lexbuf *buf); void pdf_repair_obj_stms(pdf_document *doc); -void pdf_print_xref(pdf_document *); void pdf_resize_xref(pdf_document *doc, int newcap); pdf_obj *pdf_new_ref(pdf_document *doc, pdf_obj *obj); +#ifndef NDEBUG +void pdf_print_xref(pdf_document *); +#endif + /* * Encryption */ @@ -243,7 +246,9 @@ char *pdf_crypt_method(pdf_document *doc); int pdf_crypt_length(pdf_document *doc); unsigned char *pdf_crypt_key(pdf_document *doc); +#ifndef NDEBUG void pdf_print_crypt(pdf_crypt *crypt); +#endif /* * Functions, Colorspaces, Shadings and Images @@ -364,7 +369,6 @@ void pdf_drop_cmap(fz_context *ctx, pdf_cmap *cmap); void pdf_free_cmap_imp(fz_context *ctx, fz_storable *cmap); unsigned int pdf_cmap_size(fz_context *ctx, pdf_cmap *cmap); -void pdf_print_cmap(fz_context *ctx, pdf_cmap *cmap); int pdf_cmap_wmode(fz_context *ctx, pdf_cmap *cmap); void pdf_set_cmap_wmode(fz_context *ctx, pdf_cmap *cmap, int wmode); void pdf_set_usecmap(fz_context *ctx, pdf_cmap *cmap, pdf_cmap *usecmap); @@ -385,6 +389,10 @@ pdf_cmap *pdf_load_system_cmap(fz_context *ctx, char *name); pdf_cmap *pdf_load_builtin_cmap(fz_context *ctx, char *name); pdf_cmap *pdf_load_embedded_cmap(pdf_document *doc, pdf_obj *ref); +#ifndef NDEBUG +void pdf_print_cmap(fz_context *ctx, pdf_cmap *cmap); +#endif + /* * Font */ @@ -500,7 +508,9 @@ pdf_font_desc *pdf_new_font_desc(fz_context *ctx); pdf_font_desc *pdf_keep_font(fz_context *ctx, pdf_font_desc *fontdesc); void pdf_drop_font(fz_context *ctx, pdf_font_desc *font); +#ifndef NDEBUG void pdf_print_font(fz_context *ctx, pdf_font_desc *fontdesc); +#endif /* * Interactive features diff --git a/pdf/mupdf.h b/pdf/mupdf.h index b3807852..59302951 100644 --- a/pdf/mupdf.h +++ b/pdf/mupdf.h @@ -82,8 +82,11 @@ void pdf_dict_dels(pdf_obj *dict, char *key); void pdf_sort_dict(pdf_obj *dict); int pdf_fprint_obj(FILE *fp, pdf_obj *obj, int tight); + +#ifndef NDEBUG void pdf_print_obj(pdf_obj *obj); void pdf_print_ref(pdf_obj *obj); +#endif char *pdf_to_utf8(fz_context *ctx, pdf_obj *src); unsigned short *pdf_to_ucs2(fz_context *ctx, pdf_obj *src); /* sumatrapdf */ diff --git a/pdf/pdf_cmap.c b/pdf/pdf_cmap.c index 1f1117fe..cd0d6385 100644 --- a/pdf/pdf_cmap.c +++ b/pdf/pdf_cmap.c @@ -109,6 +109,7 @@ pdf_set_cmap_wmode(fz_context *ctx, pdf_cmap *cmap, int wmode) cmap->wmode = wmode; } +#ifndef NDEBUG void pdf_print_cmap(fz_context *ctx, pdf_cmap *cmap) { @@ -155,6 +156,7 @@ pdf_print_cmap(fz_context *ctx, pdf_cmap *cmap) } printf("\t}\n}\n"); } +#endif /* * Add a codespacerange section. diff --git a/pdf/pdf_crypt.c b/pdf/pdf_crypt.c index b65786d9..65c7cf70 100644 --- a/pdf/pdf_crypt.c +++ b/pdf/pdf_crypt.c @@ -822,6 +822,7 @@ pdf_open_crypt_with_filter(fz_stream *chain, pdf_crypt *crypt, char *name, int n return chain; } +#ifndef NDEBUG void pdf_print_crypt(pdf_crypt *crypt) { int i; @@ -845,3 +846,4 @@ void pdf_print_crypt(pdf_crypt *crypt) printf("}\n"); } +#endif diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c index 0da1cdde..8c7f43a6 100644 --- a/pdf/pdf_font.c +++ b/pdf/pdf_font.c @@ -1144,6 +1144,7 @@ pdf_load_font(pdf_document *xref, pdf_obj *rdb, pdf_obj *dict) return fontdesc; } +#ifndef NDEBUG void pdf_print_font(fz_context *ctx, pdf_font_desc *fontdesc) { @@ -1175,3 +1176,4 @@ pdf_print_font(fz_context *ctx, pdf_font_desc *fontdesc) printf("\t}\n"); } } +#endif diff --git a/pdf/pdf_function.c b/pdf/pdf_function.c index 7c123476..859e0306 100644 --- a/pdf/pdf_function.c +++ b/pdf/pdf_function.c @@ -117,6 +117,7 @@ struct ps_stack_s int sp; }; +#ifndef NDEBUG void pdf_debug_ps_stack(ps_stack *st) { @@ -147,6 +148,7 @@ pdf_debug_ps_stack(ps_stack *st) printf("\n"); } +#endif static void ps_init_stack(ps_stack *st) @@ -1495,6 +1497,7 @@ pdf_eval_function(fz_context *ctx, pdf_function *func, float *in, int inlen, flo * Debugging prints */ +#ifndef NDEBUG static void pdf_debug_indent(char *prefix, int level, char *suffix) { @@ -1710,3 +1713,4 @@ pdf_debug_function(pdf_function *func) { pdf_debug_function_imp(func, 0); } +#endif diff --git a/pdf/pdf_image.c b/pdf/pdf_image.c index b4571bbe..417a08b2 100644 --- a/pdf/pdf_image.c +++ b/pdf/pdf_image.c @@ -77,6 +77,7 @@ pdf_cmp_image_key(void *k0_, void *k1_) return k0->image == k1->image && k0->factor == k1->factor; } +#ifndef NDEBUG static void pdf_debug_image(void *key_) { @@ -84,6 +85,7 @@ pdf_debug_image(void *key_) printf("(image %d x %d sf=%d) ", key->image->w, key->image->h, key->factor); } +#endif static fz_store_type pdf_image_store_type = { @@ -91,7 +93,9 @@ static fz_store_type pdf_image_store_type = pdf_keep_image_key, pdf_drop_image_key, pdf_cmp_image_key, +#ifndef NDEBUG pdf_debug_image +#endif }; static fz_pixmap * diff --git a/pdf/pdf_object.c b/pdf/pdf_object.c index 531eb8eb..7021fa5d 100644 --- a/pdf/pdf_object.c +++ b/pdf/pdf_object.c @@ -1452,6 +1452,7 @@ pdf_fprint_obj(FILE *fp, pdf_obj *obj, int tight) return n; } +#ifndef NDEBUG void pdf_print_obj(pdf_obj *obj) { @@ -1463,3 +1464,4 @@ pdf_print_ref(pdf_obj *ref) { pdf_print_obj(pdf_resolve_indirect(ref)); } +#endif diff --git a/pdf/pdf_store.c b/pdf/pdf_store.c index 2a3b8b07..2b20fca1 100644 --- a/pdf/pdf_store.c +++ b/pdf/pdf_store.c @@ -31,6 +31,7 @@ pdf_cmp_key(void *k0, void *k1) return pdf_objcmp((pdf_obj *)k0, (pdf_obj *)k1); } +#ifndef NDEBUG static void pdf_debug_key(void *key_) { @@ -42,6 +43,7 @@ pdf_debug_key(void *key_) } else pdf_print_obj(key); } +#endif static fz_store_type pdf_obj_store_type = { @@ -49,7 +51,9 @@ static fz_store_type pdf_obj_store_type = pdf_keep_key, pdf_drop_key, pdf_cmp_key, +#ifndef NDEBUG pdf_debug_key +#endif }; void diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c index 77bf5d28..10d19a94 100644 --- a/pdf/pdf_xref.c +++ b/pdf/pdf_xref.c @@ -840,6 +840,7 @@ pdf_close_document(pdf_document *xref) fz_free(ctx, xref); } +#ifndef NDEBUG void pdf_print_xref(pdf_document *xref) { @@ -855,6 +856,7 @@ pdf_print_xref(pdf_document *xref) xref->table[i].stm_buf); } } +#endif /* * compressed object streams -- cgit v1.2.3