]> mj.ucw.cz Git - libucw.git/commitdiff
tableprinter: table_end_row now calls table_clean_row
authorRobert Kessl <kesslr@centrum.cz>
Wed, 25 Jun 2014 10:33:06 +0000 (12:33 +0200)
committerRobert Kessl <kesslr@centrum.cz>
Wed, 25 Jun 2014 10:33:06 +0000 (12:33 +0200)
ucw/table.c

index 53d353b9640650ce1f8ce0846f43c2e31ff9af94..4666395f94b24e2abae5ffdab7b8037a8b899c3e 100644 (file)
@@ -311,22 +311,20 @@ void table_append_printf(struct table *tbl, const char *fmt, ...)
   va_end(args);
 }
 
-void table_end_row(struct table *tbl)
+void table_clean_row(struct table *tbl)
 {
-  ASSERT(tbl->formatter->row_output);
-  tbl->formatter->row_output(tbl);
   memset(tbl->col_str_ptrs, 0, sizeof(char *) * tbl->column_count);
   mp_restore(tbl->pool, &tbl->pool_state);
   tbl->last_printed_col = -1;
   tbl->row_printing_started = 0;
 }
 
-void table_clean_row(struct table *tbl)
+void table_end_row(struct table *tbl)
 {
-  memset(tbl->col_str_ptrs, 0, sizeof(char *) * tbl->column_count);
-  mp_restore(tbl->pool, &tbl->pool_state);
-  tbl->last_printed_col = -1;
-  tbl->row_printing_started = 0;
+  ASSERT(tbl->formatter->row_output);
+  if(tbl->row_printing_started == 0) return;
+  tbl->formatter->row_output(tbl);
+  table_clean_row(tbl);
 }
 
 /* Construction of a cell using a fastbuf */