diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-05-23 12:59:06 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-05-29 07:21:19 +0200 |
commit | 5896e03c6f0a39a0fe75ddc3cfe54af1f7dc4113 (patch) | |
tree | e3b62e14d4de55b8a2b4e0431673e9f111ac141c /src/shared/format-table.c | |
parent | Merge pull request #12687 from yuwata/parse_ifindex_or_ifname (diff) | |
download | systemd-5896e03c6f0a39a0fe75ddc3cfe54af1f7dc4113.tar.xz systemd-5896e03c6f0a39a0fe75ddc3cfe54af1f7dc4113.zip |
table: add teble_add_string_cell()
Diffstat (limited to 'src/shared/format-table.c')
-rw-r--r-- | src/shared/format-table.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/shared/format-table.c b/src/shared/format-table.c index 4f4a84d749..de72bf02f3 100644 --- a/src/shared/format-table.c +++ b/src/shared/format-table.c @@ -380,6 +380,20 @@ int table_add_cell_full( return 0; } +int table_add_cell_stringf(Table *t, TableCell **ret_cell, const char *format, ...) { + _cleanup_free_ char *buffer = NULL; + va_list ap; + int r; + + va_start(ap, format); + r = vasprintf(&buffer, format, ap); + va_end(ap); + if (r < 0) + return -ENOMEM; + + return table_add_cell(t, ret_cell, TABLE_STRING, buffer); +} + int table_dup_cell(Table *t, TableCell *cell) { size_t i; |