if (!t)
return NULL;
- *t = (struct Table) {
+ *t = (Table) {
.n_columns = n_columns,
.header = true,
.width = SIZE_MAX,
return r;
}
- for (size_t i = 0; i < t->n_display_map; i++) {
+ FOREACH_ARRAY(i, t->display_map, t->n_display_map) {
bool listed = false;
va_list ap;
column = va_arg(ap, size_t);
if (column == SIZE_MAX)
break;
- if (column == t->display_map[i]) {
+ if (column == *i) {
listed = true;
break;
}
if (listed)
continue;
- t->display_map[cur++] = t->display_map[i];
+ t->display_map[cur++] = *i;
}
t->n_display_map = cur;
return ret;
}
-static bool table_data_isempty(TableData *d) {
+static bool table_data_isempty(const TableData *d) {
assert(d);
if (d->type == TABLE_EMPTY)
return false;
}
-static const char* table_data_color(TableData *d) {
+static const char* table_data_color(const TableData *d) {
assert(d);
if (d->color)
return NULL;
}
-static const char* table_data_rgap_color(TableData *d) {
+static const char* table_data_rgap_color(const TableData *d) {
assert(d);
return d->rgap_color ?: d->rgap_color;
}
-static const char* table_data_underline(TableData *d) {
+static const char* table_data_underline(const TableData *d) {
assert(d);
if (d->underline)
- return /* cescape( */ansi_add_underline_grey()/* ) */;
+ return ansi_add_underline_grey();
if (d->type == TABLE_HEADER)
return ansi_add_underline();
return NULL;
}
-static const char* table_data_rgap_underline(TableData *d) {
+static const char* table_data_rgap_underline(const TableData *d) {
assert(d);
if (d->rgap_underline)