for(int i = 0; i < tbl->column_count; i++) {
tbl->columns[i].first_column = -1;
- tbl->columns[i].last_column = -1;
}
for(int i = 0; i < cols_to_output; i++) {
}
for(int i = 0; i < cols_to_output; i++) {
- int last = tbl->column_order[i].col_def->last_column;
- if(last != -1) {
- tbl->column_order[i].col_def->last_column = i;
- tbl->column_order[last].next_column = i;
+ int first = tbl->column_order[i].col_def->first_column;
+ tbl->column_order[i].col_def->first_column = i;
+
+ if(first != -1) {
+ tbl->column_order[i].next_column = first;
} else {
- tbl->column_order[i].col_def->last_column = i;
- tbl->column_order[i].col_def->first_column = i;
+ tbl->column_order[i].next_column = -1;
}
- tbl->column_order[i].next_column = -1;
}
}
const char *fmt; // [*] Default format of each cell in the column
enum column_type type; // [*] Type of the cells in the column
int first_column; // head of linked list of columns of this type
- int last_column; // tail of linked list of columns of this type
+ //int last_column; // tail of linked list of columns of this type
struct table_user_type *type_def;
};
// FIXME: is it correct to have idx and col_def? idx is sufficient and in fact a duplicity of idx
+// idx is used only for initialization and col_def is used in other cases
struct table_col_info {
uint idx; // idx is a pointer to struct table::columns
struct table_column *col_def; // this is pointer to the column definition, located in the array struct table::columns
*
***/
-#define TBL_COL_LIST_INIT .first_column = -1, .last_column = -1
+#define TBL_COL_LIST_INIT .first_column = -1
#define TBL_COL_STR(_name, _width) { .name = _name, .width = _width, .fmt = "%s", .type = COL_TYPE_STR, TBL_COL_LIST_INIT }
#define TBL_COL_INT(_name, _width) { .name = _name, .width = _width, .fmt = "%d", .type = COL_TYPE_INT, TBL_COL_LIST_INIT }
#define TBL_COL_S64(_name, _width) { .name = _name, .width = _width, .fmt = "%lld", .type = COL_TYPE_S64, TBL_COL_LIST_INIT }