From 930abfc743be2b16d6076df72ffca65c43028366 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 25 Apr 2006 15:04:19 +0000 Subject: [PATCH] * Small optimisation in import_text(). --- cucul/import.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cucul/import.c b/cucul/import.c index 10c7314..03cdbe0 100644 --- a/cucul/import.c +++ b/cucul/import.c @@ -39,6 +39,8 @@ static cucul_canvas_t *import_ansi(void const *, unsigned int); * * \li \c "": attempt to autodetect the file format. * + * \li \c "ansi": import ANSI files. + * * \li \c "caca": import native libcaca files. * * \param data The memory area to be loaded into a canvas. @@ -175,15 +177,10 @@ static cucul_canvas_t *import_text(void const *data, unsigned int size) continue; } - while(x >= width) - { - width++; - cucul_set_canvas_size(cv, width, height); - } - - while(y >= height) + if(x >= width || y >= height) { - height++; + width = x + 1; + height = y + 1; cucul_set_canvas_size(cv, width, height); }