Skip to content

Commit e702dd9

Browse files
authored
Remove c_format as redundant (#182)
1 parent b1f9f75 commit e702dd9

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

src/xinterpreter.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -339,29 +339,6 @@ __get_cxx_version ()
339339
restore_output();
340340
}
341341

342-
static std::string c_format(const char* format, std::va_list args)
343-
{
344-
// Call vsnprintf once to determine the required buffer length. The
345-
// return value is the number of characters _excluding_ the null byte.
346-
std::va_list args_bufsz;
347-
va_copy(args_bufsz, args);
348-
std::size_t bufsz = vsnprintf(NULL, 0, format, args_bufsz);
349-
va_end(args_bufsz);
350-
351-
// Create an empty string of that size.
352-
std::string s(bufsz, 0);
353-
354-
// Now format the data into this string and return it.
355-
std::va_list args_format;
356-
va_copy(args_format, args);
357-
// The second parameter is the maximum number of bytes that vsnprintf
358-
// will write _including_ the terminating null byte.
359-
vsnprintf(&s[0], s.size() + 1, format, args_format);
360-
va_end(args_format);
361-
362-
return s;
363-
}
364-
365342
void interpreter::redirect_output()
366343
{
367344
p_cout_strbuf = std::cout.rdbuf();

0 commit comments

Comments
 (0)