libansilove

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

commit 6eb8218b97d6f3f0d38dcaac56aafb986ccbca35
parent f9c3f24ec3c40c706d7dd0e56daf52aaf2cb26e6
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue, 17 Mar 2020 13:35:09 +0100

Use the ternary operator to simplify character attributes assignments.

Diffstat:
Msrc/loaders/ansi.c | 14+++++---------
1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -440,15 +440,11 @@ ansilove_ansi(struct ansilove_ctx *ctx, struct ansilove_options *options) ansi_buffer[structIndex].background = foreground % 8; ansi_buffer[structIndex].foreground = background + (foreground & 8); } else { - if (background24) - ansi_buffer[structIndex].background = background24; - else - ansi_buffer[structIndex].background = background; - - if (foreground24) - ansi_buffer[structIndex].foreground = foreground24; - else - ansi_buffer[structIndex].foreground = foreground; + ansi_buffer[structIndex].background = + background24 ? background24 : background; + + ansi_buffer[structIndex].foreground = + foreground24 ? foreground24 : foreground; } ansi_buffer[structIndex].character = current_character; ansi_buffer[structIndex].column = column;