mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
format-table: add an API for getting the cell at a specific row/column
This commit is contained in:
parent
27e730e6d0
commit
9314ead785
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user