]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
format-table: if NULL is spcified as data, let's patch to an empty cell
authorLennart Poettering <lennart@poettering.net>
Mon, 29 Jul 2019 16:36:59 +0000 (18:36 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 29 Jul 2019 16:48:25 +0000 (18:48 +0200)
This should make various calls easier that currently generate either an
empty cell or a regular cell depending on whether they have data to
show.

src/shared/format-table.c

index 51ddd1ac519806d8c8867cf9150ca9516a028312..d2764eebbd8682ed46175367475b44b9fb24f692 100644 (file)
@@ -356,6 +356,10 @@ int table_add_cell_full(
         assert(type >= 0);
         assert(type < _TABLE_DATA_TYPE_MAX);
 
+        /* Special rule: patch NULL data fields to the empty field */
+        if (!data)
+                type = TABLE_EMPTY;
+
         /* Determine the cell adjacent to the current one, but one row up */
         if (t->n_cells >= t->n_columns)
                 assert_se(p = t->data[t->n_cells - t->n_columns]);