From f28cdea3f2e2db0fa7064b4948bd7162dec117ef Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 15 Apr 2022 16:00:49 -0500 Subject: [PATCH] Cleanup: Remove unnecessary condition block. --- level_3/byte_dump/c/private-byte_dump.c | 42 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index e9c54e4..54451ae 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -196,43 +196,41 @@ extern "C" { width_count = 0; // Handle incomplete character at the end of the stream. - if (width_count < width_utf) { - found_invalid_utf = F_true; - invalid[character_current] = width_utf; + found_invalid_utf = F_true; + invalid[character_current] = width_utf; - if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 1, &previous, &cell, &offset) == F_true) { + if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 1, &previous, &cell, &offset) == F_true) { + character_reset = F_true; + } + + if (++width_count < width_missing) { + if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 2, &previous, &cell, &offset) == F_true) { character_reset = F_true; } if (++width_count < width_missing) { - if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 2, &previous, &cell, &offset) == F_true) { + if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 3, &previous, &cell, &offset) == F_true) { character_reset = F_true; } if (++width_count < width_missing) { - if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 3, &previous, &cell, &offset) == F_true) { + if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 4, &previous, &cell, &offset) == F_true) { character_reset = F_true; } - - if (++width_count < width_missing) { - if (byte_dump_print_character_fragment(data, characters, invalid, width_utf, 4, &previous, &cell, &offset) == F_true) { - character_reset = F_true; - } - } } } + } - if (character_reset) { - characters.used = 0; - memset(&invalid, 0, sizeof(f_char_t) * data->width); + if (character_reset) { + characters.used = 0; + memset(&invalid, 0, sizeof(f_char_t) * data->width); - previous.bytes = column_offset; - previous.invalid = previous.bytes; - } - else { - previous.bytes = 0; - previous.invalid = 0; - } + previous.bytes = column_offset; + previous.invalid = previous.bytes; + } + else { + previous.bytes = 0; + previous.invalid = 0; } while (cell.column < data->width) { -- 1.8.3.1