Skip to content

Commit b6b7337

Browse files
committed
fix(console): Remove dead code findings from coverity
1 parent 19cc026 commit b6b7337

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

components/console/argtable3/arg_int.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@ static int arg_int_scanfn(struct arg_int* parent, const char* argval) {
175175
}
176176
}
177177

178-
/* Safety check for integer overflow. WARNING: this check */
179-
/* achieves nothing on machines where size(int)==size(long). */
180-
if (val > INT_MAX || val < INT_MIN)
181-
errorcode = ARG_ERR_OVERFLOW;
182-
183178
/* Detect any suffixes (KB,MB,GB) and multiply argument value appropriately. */
184179
/* We need to be mindful of integer overflows when using such big numbers. */
185180
if (detectsuffix(end, "KB")) /* kilobytes */

components/console/argtable3/argtable3.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static void arg_parse_untagged(int argc, char** argv, struct arg_hdr** table, st
390390
}
391391
}
392392

393-
/* if a tenative error still remains at this point then register it as a proper error */
393+
/* if a tentative error still remains at this point then register it as a proper error */
394394
if (errorlast) {
395395
arg_register_error(endtable, parentlast, errorlast, optarglast);
396396
optind++;
@@ -528,7 +528,7 @@ static void arg_cat_option(char* dest, size_t ndest, const char* shortopts, cons
528528
if (shortopts) {
529529
char option[3];
530530

531-
/* note: option array[] is initialiazed dynamically here to satisfy */
531+
/* note: option array[] is initialized dynamically here to satisfy */
532532
/* a deficiency in the watcom compiler wrt static array initializers. */
533533
option[0] = '-';
534534
option[1] = shortopts[0];
@@ -586,7 +586,7 @@ static void arg_cat_optionv(char* dest, size_t ndest, const char* shortopts, con
586586
/* "-a|-b|-c" */
587587
char shortopt[3];
588588

589-
/* note: shortopt array[] is initialiazed dynamically here to satisfy */
589+
/* note: shortopt array[] is initialized dynamically here to satisfy */
590590
/* a deficiency in the watcom compiler wrt static array initializers. */
591591
shortopt[0] = '-';
592592
shortopt[1] = *c;
@@ -865,7 +865,7 @@ void arg_print_glossary(FILE* fp, void** argtable, const char* format) {
865865

866866
/**
867867
* Print a piece of text formatted, which means in a column with a
868-
* left and a right margin. The lines are wrapped at whitspaces next
868+
* left and a right margin. The lines are wrapped at whitespaces next
869869
* to right margin. The function does not indent the first line, but
870870
* only the following ones.
871871
*
@@ -879,11 +879,6 @@ static void arg_print_formatted_ds(arg_dstr_t ds, const unsigned lmargin, const
879879

880880
assert(strlen(text) < UINT_MAX);
881881

882-
/* Someone doesn't like us... */
883-
if (line_end < line_start) {
884-
arg_dstr_catf(ds, "%s\n", text);
885-
}
886-
887882
while (line_end > line_start) {
888883
/* Eat leading white spaces. This is essential because while
889884
wrapping lines, there will often be a whitespace at beginning
@@ -945,7 +940,7 @@ static void arg_print_formatted_ds(arg_dstr_t ds, const unsigned lmargin, const
945940

946941
/**
947942
* Print a piece of text formatted, which means in a column with a
948-
* left and a right margin. The lines are wrapped at whitspaces next
943+
* left and a right margin. The lines are wrapped at whitespaces next
949944
* to right margin. The function does not indent the first line, but
950945
* only the following ones.
951946
*
@@ -1073,7 +1068,7 @@ void arg_free(void** argtable) {
10731068
do {
10741069
/*
10751070
if we encounter a NULL entry then somewhat incorrectly we presume
1076-
we have come to the end of the array. It isnt strictly true because
1071+
we have come to the end of the array. It isn't strictly true because
10771072
an intermediate entry could be NULL with other non-NULL entries to follow.
10781073
The subsequent argtable entries would then not be freed as they should.
10791074
*/

0 commit comments

Comments
 (0)