mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 15:23:39 +00:00
Merge pull request #732 from qlyoung/coverity-memes
lib: termtable coverity warnings
This commit is contained in:
commit
a88bbcb8a0
@ -123,15 +123,13 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i,
|
|||||||
assert(i >= -1 && i < tt->nrows);
|
assert(i >= -1 && i < tt->nrows);
|
||||||
|
|
||||||
char *res, *orig, *section;
|
char *res, *orig, *section;
|
||||||
const char *f;
|
|
||||||
struct ttable_cell *row;
|
struct ttable_cell *row;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
int ncols = 0;
|
int ncols = 0;
|
||||||
|
|
||||||
/* count how many columns we have */
|
/* count how many columns we have */
|
||||||
f = format;
|
for (int i = 0; format[i]; i++)
|
||||||
for (; f[ncols]; f[ncols] == '|' ? ncols++ : *f++)
|
ncols += !!(format[i] == '|');
|
||||||
;
|
|
||||||
ncols++;
|
ncols++;
|
||||||
|
|
||||||
if (tt->ncols == 0)
|
if (tt->ncols == 0)
|
||||||
@ -338,7 +336,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
|
|||||||
/* calculate number of lines en total */
|
/* calculate number of lines en total */
|
||||||
nlines = tt->nrows;
|
nlines = tt->nrows;
|
||||||
nlines += tt->style.border.top_on ? 1 : 0;
|
nlines += tt->style.border.top_on ? 1 : 0;
|
||||||
nlines += tt->style.border.bottom_on ? 1 : 1; // makes life easier
|
nlines += 1; // tt->style.border.bottom_on ? 1 : 1; makes life easier
|
||||||
for (int i = 0; i < tt->nrows; i++) {
|
for (int i = 0; i < tt->nrows; i++) {
|
||||||
/* if leftmost cell has top / bottom border, whole row does */
|
/* if leftmost cell has top / bottom border, whole row does */
|
||||||
nlines += tt->table[i][0].style.border.top_on ? 1 : 0;
|
nlines += tt->table[i][0].style.border.top_on ? 1 : 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user