| 287 | ////////////////////////////////////////////////////////////////////////// |
| 288 | |
| 289 | std::string format(const char* _format, ...) |
| 290 | { |
| 291 | va_list args; |
| 292 | va_list copy; |
| 293 | |
| 294 | va_start(args, _format); |
| 295 | |
| 296 | va_copy(copy, args); |
| 297 | const int length = vsnprintf(nullptr, 0, _format, copy); |
| 298 | va_end(copy); |
| 299 | |
| 300 | char* buffer = new char[length + 1]; |
| 301 | va_copy(copy, args); |
| 302 | vsnprintf(buffer, length + 1, _format, copy); |
| 303 | va_end(copy); |
| 304 | |
| 305 | va_end(args); |
| 306 | |
| 307 | std::string out(buffer); |
| 308 | delete[] buffer; |
| 309 | |
| 310 | return out; |
| 311 | |
| 312 | } // format |
| 313 | |
| 314 | ////////////////////////////////////////////////////////////////////////// |
| 315 |
no outgoing calls
no test coverage detected