diff --git a/src/common/classes/fb_string.cpp b/src/common/classes/fb_string.cpp index dbc192180e..76a59946c8 100644 --- a/src/common/classes/fb_string.cpp +++ b/src/common/classes/fb_string.cpp @@ -363,6 +363,13 @@ extern "C" { } void AbstractString::printf(const char* format,...) { + va_list params; + va_start(params, format); + vprintf(format, params); + va_end(params); + } + + void AbstractString::vprintf(const char* format, va_list params) { #ifndef HAVE_VSNPRINTF #error NS: I'm lazy to implement version of this routine based on plain vsprintf. #error Please find an implementation of vsnprintf function for your platform. @@ -371,8 +378,6 @@ extern "C" { #endif enum {tempsize = 256}; char temp[tempsize]; - va_list params; - va_start(params, format); int l = VSNPRINTF(temp, tempsize, format, params); if (l < 0) { size_type n = sizeof(temp); @@ -399,7 +404,6 @@ extern "C" { resize(l); VSNPRINTF(begin(), l + 1, format, params); } - va_end(params); } int PathNameComparator::compare(AbstractString::const_pointer s1, AbstractString::const_pointer s2, AbstractString::size_type n) { diff --git a/src/include/fb_string.h b/src/include/fb_string.h index c3a31834ed..062400c75d 100644 --- a/src/include/fb_string.h +++ b/src/include/fb_string.h @@ -347,6 +347,7 @@ namespace Firebird baseTrim(TrimBoth, ToTrim); } bool LoadFromFile(FILE *file); + void vprintf(const char* Format, va_list params); void printf(const char* Format, ...); inline ~AbstractString() { if (stringBuffer != inlineBuffer)