table: add teble_add_string_cell()
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ int table_add_cell_full(Table *t, TableCell **ret_cell, TableDataType type, cons
|
||||
static inline int table_add_cell(Table *t, TableCell **ret_cell, TableDataType type, const void *data) {
|
||||
return table_add_cell_full(t, ret_cell, type, data, (size_t) -1, (size_t) -1, (unsigned) -1, (unsigned) -1, (unsigned) -1);
|
||||
}
|
||||
int table_add_cell_stringf(Table *t, TableCell **ret_cell, const char *format, ...) _printf_(3, 4);
|
||||
|
||||
int table_dup_cell(Table *t, TableCell *cell);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user