From ee382eb9e03bd609bc0da95a77e7b7232d7e56d5 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 5 Jul 2012 16:56:32 +0100 Subject: Move to static inline functions from macros. Instead of using macros for min/max/abs/clamp, we move to using inline functions. These are more typesafe, and should produce equivalent code on compilers that support inline (i.e. pretty much everything we care about these days). People can always do their own macro versions if they prefer. --- fitz/dev_text.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'fitz/dev_text.c') diff --git a/fitz/dev_text.c b/fitz/dev_text.c index cd76830d..280d1b55 100644 --- a/fitz/dev_text.c +++ b/fitz/dev_text.c @@ -129,7 +129,7 @@ append_char(fz_context *ctx, fz_text_span *span, int c, fz_rect bbox) { if (span->len == span->cap) { - int new_cap = MAX(64, span->cap * 2); + int new_cap = fz_maxi(64, span->cap * 2); span->text = fz_resize_array(ctx, span->text, new_cap, sizeof(*span->text)); span->cap = new_cap; } @@ -155,7 +155,7 @@ append_span(fz_context *ctx, fz_text_line *line, fz_text_span *span) return; if (line->len == line->cap) { - int new_cap = MAX(8, line->cap * 2); + int new_cap = fz_maxi(8, line->cap * 2); line->spans = fz_resize_array(ctx, line->spans, new_cap, sizeof(*line->spans)); line->cap = new_cap; } @@ -176,7 +176,7 @@ append_line(fz_context *ctx, fz_text_block *block, fz_text_line *line) { if (block->len == block->cap) { - int new_cap = MAX(16, block->cap * 2); + int new_cap = fz_maxi(16, block->cap * 2); block->lines = fz_resize_array(ctx, block->lines, new_cap, sizeof *block->lines); block->cap = new_cap; } @@ -198,13 +198,13 @@ lookup_block_for_line(fz_context *ctx, fz_text_page *page, fz_text_line *line) float dy = line->bbox.y0 - block->bbox.y1; if (dy > -size * 1.5f && dy < size * PARAGRAPH_DIST) if (line->bbox.x0 <= block->bbox.x1 && line->bbox.x1 >= block->bbox.x0) - if (ABS(dx) < w / 2) + if (fz_abs(dx) < w / 2) return block; } if (page->len == page->cap) { - int new_cap = MAX(16, page->cap * 2); + int new_cap = fz_maxi(16, page->cap * 2); page->blocks = fz_resize_array(ctx, page->blocks, new_cap, sizeof(*page->blocks)); page->cap = new_cap; } -- cgit v1.2.3