From d05ca45cf9b9b4a2a2cdc6a97017e3e6859c7f02 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Apr 07 2021 22:35:34 +0000 Subject: format-table: add calls to query the data in a specific cell (cherry picked from commit 62d99b39709f903f8a66a9aae757deb5546a53eb) Related: #1689832 patch_name: 0133-format-table-add-calls-to-query-the-data-in-a-specif.patch present_in_specfile: true location_in_specfile: 133 squash_commits: true --- diff --git a/src/basic/format-table.c b/src/basic/format-table.c index 3fcb974..0a1777e 100644 --- a/src/basic/format-table.c +++ b/src/basic/format-table.c @@ -1438,3 +1438,25 @@ TableCell *table_get_cell(Table *t, size_t row, size_t column) { return TABLE_INDEX_TO_CELL(i); } + +const void *table_get(Table *t, TableCell *cell) { + TableData *d; + + assert(t); + + d = table_get_data(t, cell); + if (!d) + return NULL; + + return d->data; +} + +const void* table_get_at(Table *t, size_t row, size_t column) { + TableCell *cell; + + cell = table_get_cell(t, row, column); + if (!cell) + return NULL; + + return table_get(t, cell); +} diff --git a/src/basic/format-table.h b/src/basic/format-table.h index 40fea79..a2bb2e0 100644 --- a/src/basic/format-table.h +++ b/src/basic/format-table.h @@ -68,3 +68,6 @@ 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); + +const void *table_get(Table *t, TableCell *cell); +const void *table_get_at(Table *t, size_t row, size_t column);