Implement actual error handling for builtin_printf. Fix the tests.

This commit is contained in:
ridiculousfish
2013-03-24 15:24:29 -07:00
parent 3b4f4c5f59
commit 9394583f96
5 changed files with 182 additions and 130 deletions

View File

@@ -471,15 +471,21 @@ wcstring vformat_string(const wchar_t *format, va_list va_orig)
return result;
}
void append_format(wcstring &str, const wchar_t *format, ...)
void append_formatv(wcstring &str, const wchar_t *format, va_list ap)
{
/* Preserve errno across this call since it likes to stomp on it */
int err = errno;
str.append(vformat_string(format, ap));
errno = err;
}
void append_format(wcstring &str, const wchar_t *format, ...)
{
va_list va;
va_start(va, format);
str.append(vformat_string(format, va));
append_formatv(str, format, va);
va_end(va);
errno = err;
}
wchar_t *wcsvarname(const wchar_t *str)