X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=string-table.c;h=95833768960d925861f71812002e757115b7ab74;hb=refs%2Fchanges%2F82%2F236382%2F1;hp=2d05e4dc3b6e031b41c4cb860e603691211ae24d;hpb=850ad2ce35b27476dc80afdf92ac63ad7f1f3571;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/string-table.c b/string-table.c index 2d05e4d..9583376 100644 --- a/string-table.c +++ b/string-table.c @@ -49,7 +49,7 @@ struct string_table *table_create(int columns, int rows) * be replaced by a '=====' dimensioned on the basis of the column width */ char *table_vprintf(struct string_table *tab, int column, int row, - char *fmt, va_list ap) + const char *fmt, va_list ap) { int idx = tab->ncols * row + column; char *msg = calloc(100, 1); @@ -69,8 +69,9 @@ char *table_vprintf(struct string_table *tab, int column, int row, * This function is like a printf, but store the results in a cell of * the table. */ +__attribute__ ((format (printf, 4, 5))) char *table_printf(struct string_table *tab, int column, int row, - char *fmt, ...) + const char *fmt, ...) { va_list ap; char *ret; @@ -101,7 +102,7 @@ void table_dump(struct string_table *tab) continue; len = strlen(tab->cells[idx]) - 1; - if (len < 1 || tab->cells[idx][0] == '=') + if (len == 0 || tab->cells[idx][0] == '*') continue; if (len > sizes[i]) @@ -116,11 +117,11 @@ void table_dump(struct string_table *tab) if (!cell || !strlen(cell)) { printf("%*s", sizes[i], ""); - } else if (cell && cell[0] == '=') { + } else if (cell && cell[0] == '*' && cell[1]) { int k = sizes[i]; while (k--) - putchar('='); + putchar(cell[1]); } else { printf("%*s", cell[0] == '<' ? -sizes[i] : sizes[i],