From: Lennart Poettering Date: Fri, 9 Nov 2018 10:38:12 +0000 (+0100) Subject: format-table: add calls to query the data in a specific cell X-Git-Tag: v240~167^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=62d99b39709f903f8a66a9aae757deb5546a53eb;p=thirdparty%2Fsystemd.git format-table: add calls to query the data in a specific cell --- diff --git a/src/shared/format-table.c b/src/shared/format-table.c index b5af0f5fe04..8189c3475d9 100644 --- a/src/shared/format-table.c +++ b/src/shared/format-table.c @@ -1392,3 +1392,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/shared/format-table.h b/src/shared/format-table.h index 40fea79f787..a2bb2e0846d 100644 --- a/src/shared/format-table.h +++ b/src/shared/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);