libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

commit d405484b1441494bf84fd709f739cd509a8150d8
parent 561ada24f3fafe77b2a45bb3232ed8b330bc6251
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat, 18 Jan 2020 23:19:58 +0100

Use a while loop instead of a for loop, makes the code easier to read.

Diffstat:
Msrc/loaders/icedraw.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -48,7 +48,7 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) uint32_t colors[16]; /* process IDF */ - uint32_t idf_sequence_length, idf_sequence_loop, i = 0; + uint32_t idf_sequence_length, i = 0; /* dynamically allocated memory buffer for IDF data */ uint8_t *ptr, *idf_buffer; @@ -59,7 +59,7 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) if (ctx->buffer[loop] == 1) { idf_sequence_length = ctx->buffer[loop+2]; - for (idf_sequence_loop = 0; idf_sequence_loop < idf_sequence_length; idf_sequence_loop++) + while (idf_sequence_length--) { /* reallocate IDF buffer memory */ ptr = realloc(idf_buffer, i + 2);