summaryrefslogtreecommitdiff
path: root/lib/termtable.c
diff options
context:
space:
mode:
authorDaniel Walton <dwalton76@gmail.com>2017-06-21 10:30:29 -0400
committerGitHub <noreply@github.com>2017-06-21 10:30:29 -0400
commitc1a44e43672607a557d895cade446e776c11ce1f (patch)
treeaa6177c84e1c44542bb3a4e3b870a67afaaa2ef4 /lib/termtable.c
parentbf468c3ca5d96af40ba4af4967ec3e48fdf76447 (diff)
parent2ca02077216cc8d8bde6b6da279f9fd03e0ac04a (diff)
Merge branch 'master' into bgpd-ipv4-plus-label-misc3
Diffstat (limited to 'lib/termtable.c')
-rw-r--r--lib/termtable.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/termtable.c b/lib/termtable.c
index fb16e5dba1..283fa173d8 100644
--- a/lib/termtable.c
+++ b/lib/termtable.c
@@ -123,15 +123,13 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i,
assert(i >= -1 && i < tt->nrows);
char *res, *orig, *section;
- const char *f;
struct ttable_cell *row;
int col = 0;
int ncols = 0;
/* count how many columns we have */
- f = format;
- for (; f[ncols]; f[ncols] == '|' ? ncols++ : *f++)
- ;
+ for (int i = 0; format[i]; i++)
+ ncols += !!(format[i] == '|');
ncols++;
if (tt->ncols == 0)
@@ -338,7 +336,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
/* calculate number of lines en total */
nlines = tt->nrows;
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++) {
/* if leftmost cell has top / bottom border, whole row does */
nlines += tt->table[i][0].style.border.top_on ? 1 : 0;