table

Помоћни програм из командне линије за форматирање и приказ CSV-а
git clone https://git.sr.ht/~strahinja/table
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување b4cd5a01957a88e4341edf3084a9010976d59ea0
родитељ dd17bfac3c6325bbc605106c1ed7d3481f31bffd
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Thu, 16 May 2024 13:03:21 +0200

table.c: Fix several instances of dead code thanks to LLVM's scan-build

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
Mtable.c | 35+++--------------------------------
измењених датотека: 1, додавања: 3(+), брисања: 32(-)

diff --git a/table.c b/table.c @@ -492,7 +492,6 @@ print_aligned(const u8* s, size_t rune_length, size_t to_size, Alignment align, output_runes++; } skip_while_sgr(ps, &skipped_chars, 1, 1); - ps += skipped_chars; } else if (align == ALIGN_CENTER) { @@ -526,7 +525,6 @@ print_aligned(const u8* s, size_t rune_length, size_t to_size, Alignment align, output_runes++; } skip_while_sgr(ps, &skipped_chars, 1, 1); - ps += skipped_chars; } else if (align == ALIGN_RIGHT) { @@ -559,7 +557,6 @@ print_aligned(const u8* s, size_t rune_length, size_t to_size, Alignment align, output_runes++; } skip_while_sgr(ps, &skipped_chars, 1, 1); - ps += skipped_chars; } (*current_rune_column) += output_runes; return 0; @@ -655,25 +652,16 @@ do_arg: else if (!strcmp(arg, "version")) cmd = CMD_VERSION; else if (!strcmp(arg, "align-header")) - { - arg += strlen("align-header"); align_header = 1; - } else if (!strcmp(arg, "align-dot")) - { - arg += strlen("align-dot"); alignment_char = '.'; - } else if (startswith(arg, "align=")) { arg += strlen("align="); set_align(arg, &align, &align_size); } else if (!strcmp(arg, "border-mode")) - { - arg += strlen("border-mode"); border_mode = 1; - } else if (startswith(arg, "columns=")) { arg += strlen("columns="); @@ -693,30 +681,18 @@ do_arg: arg)); } else if (!strcmp(arg, "expand-tabs")) - { - arg += strlen("expand-tabs"); expand_tabs = 1; - } else if (startswith(arg, "format=")) { arg += strlen("format="); set_format(arg, &format, &format_size); } else if (!strcmp(arg, "msdos")) - { - arg += strlen("msdos"); msdos = 1; - } else if (!strcmp(arg, "no-ansi")) - { - arg += strlen("no-ansi"); no_ansi = 1; - } else if (!strcmp(arg, "pause")) - { - arg += strlen("pause"); opause = 1; - } else if (startswith(arg, "quotes=")) { arg += strlen("quotes="); @@ -737,10 +713,7 @@ do_arg: arg)); } else if (!strcmp(arg, "yes-ansi")) - { - arg += strlen("yes-ansi"); no_ansi = 0; - } else if (!strcmp(arg, "help")) return usage(); else @@ -1135,7 +1108,7 @@ continue_line: size_t colwidth = current_column_width(); if (!no_ansi && lineno == 0) - poutbuf += snprintf((char*)poutbuf, BUFSIZE, "%s", + snprintf((char*)poutbuf, BUFSIZE, "%s", ANSI_SGR_BOLD_OFF); print_aligned(outbuf, outbufrunelen, colwidth, @@ -1220,7 +1193,7 @@ done_line:; : format_value; if (!no_ansi && lineno == 0) - poutbuf += snprintf((char*)poutbuf, BUFSIZE, "%s", + snprintf((char*)poutbuf, BUFSIZE, "%s", ANSI_SGR_BOLD_OFF); print_aligned(outbuf, outbufrunelen, colwidth, @@ -1231,9 +1204,7 @@ done_line:; : ALIGN_LEFT), &current_rune_column); - *outbuf = 0; - poutbuf = outbuf; - outbufrunelen = 0; + *outbuf = 0; } while (current_table_column < table_columns - 1) {