diff --git a/src/shared/format-table.c b/src/shared/format-table.c index 9b9796a625..5292843acb 100644 --- a/src/shared/format-table.c +++ b/src/shared/format-table.c @@ -1370,3 +1370,18 @@ int table_set_reverse(Table *t, size_t column, bool b) { t->reverse_map[column] = b; return 0; } + +TableCell *table_get_cell(Table *t, size_t row, size_t column) { + size_t i; + + assert(t); + + if (column >= t->n_columns) + return NULL; + + i = row * t->n_columns + column; + if (i >= t->n_cells) + return NULL; + + return TABLE_INDEX_TO_CELL(i); +} diff --git a/src/shared/format-table.h b/src/shared/format-table.h index 4273c8c49b..40fea79f78 100644 --- a/src/shared/format-table.h +++ b/src/shared/format-table.h @@ -66,3 +66,5 @@ static inline TableCell* TABLE_HEADER_CELL(size_t i) { size_t table_get_rows(Table *t); size_t table_get_columns(Table *t); + +TableCell *table_get_cell(Table *t, size_t row, size_t column);