From a8ca33a33ad9d927a28334d8e4c45d5c40d16168 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sat, 18 Aug 2018 14:13:27 +0200 Subject: Add stringf() helper function Signed-off-by: Clifford Wolf --- common/log.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'common/log.cc') diff --git a/common/log.cc b/common/log.cc index df5430bb..e30449ad 100644 --- a/common/log.cc +++ b/common/log.cc @@ -46,6 +46,18 @@ void (*log_error_atexit)() = NULL; // static bool next_print_log = false; static int log_newline_count = 0; +std::string stringf(const char *fmt, ...) +{ + std::string string; + va_list ap; + + va_start(ap, fmt); + string = vstringf(fmt, ap); + va_end(ap); + + return string; +} + std::string vstringf(const char *fmt, va_list ap) { std::string string; -- cgit v1.2.3