Add stringf() helper function
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
97520bb728
commit
a8ca33a33a
@ -46,6 +46,18 @@ void (*log_error_atexit)() = NULL;
|
|||||||
// static bool next_print_log = false;
|
// static bool next_print_log = false;
|
||||||
static int log_newline_count = 0;
|
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 vstringf(const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
std::string string;
|
std::string string;
|
||||||
|
@ -51,6 +51,9 @@ extern bool log_quiet_warnings;
|
|||||||
extern std::string log_last_error;
|
extern std::string log_last_error;
|
||||||
extern void (*log_error_atexit)();
|
extern void (*log_error_atexit)();
|
||||||
|
|
||||||
|
std::string stringf(const char *fmt, ...);
|
||||||
|
std::string vstringf(const char *fmt, va_list ap);
|
||||||
|
|
||||||
extern std::ostream clog;
|
extern std::ostream clog;
|
||||||
void log(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
|
void log(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
|
||||||
void log_always(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
|
void log_always(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
|
||||||
|
Loading…
Reference in New Issue
Block a user