From 8cba76541b7b1b050508b0b401e5a0471eb59fc6 Mon Sep 17 00:00:00 2001 From: Laurent MONIN Date: Fri, 2 Jun 2006 18:54:03 +0200 Subject: [PATCH] Code simplification and tidy up. --- src/document/html/renderer.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index fb1dc99f..aea01f9e 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -1887,7 +1887,6 @@ render_html_document(struct cache_entry *cached, struct document *document, unsigned char *end; struct string title; struct string head; - int i; assert(cached && document); if_assert_failed return; @@ -1929,17 +1928,17 @@ render_html_document(struct cache_entry *cached, struct document *document, /* Drop empty allocated lines at end of document if any * and adjust document height. */ - for (i = document->height - 1; i >= 0 ; i--) { - if (!document->data[i].length) { - mem_free_if(document->data[i].chars); - document->height--; - } else break; - } + while (document->height && !document->data[document->height - 1].length) + mem_free_if(document->data[--document->height].chars); /* Calculate document width. */ - document->width = 0; - for (i = 0; i < document->height; i++) - int_lower_bound(&document->width, document->data[i].length); + { + int i; + + document->width = 0; + for (i = 0; i < document->height; i++) + int_lower_bound(&document->width, document->data[i].length); + } #if 1 document->options.needs_width = 1;