diff options
Diffstat (limited to 'libcxx/src/filesystem/format_string.h')
-rw-r--r-- | libcxx/src/filesystem/format_string.h | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/libcxx/src/filesystem/format_string.h b/libcxx/src/filesystem/format_string.h index e91475e..8d17b02 100644 --- a/libcxx/src/filesystem/format_string.h +++ b/libcxx/src/filesystem/format_string.h @@ -11,6 +11,7 @@ #include <__assert> #include <__config> +#include <__utility/scope_guard.h> #include <array> #include <cstdarg> #include <cstddef> @@ -55,17 +56,8 @@ inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) string format_string(const cha string ret; va_list ap; va_start(ap, msg); -#if _LIBCPP_HAS_EXCEPTIONS - try { -#endif // _LIBCPP_HAS_EXCEPTIONS - ret = detail::vformat_string(msg, ap); -#if _LIBCPP_HAS_EXCEPTIONS - } catch (...) { - va_end(ap); - throw; - } -#endif // _LIBCPP_HAS_EXCEPTIONS - va_end(ap); + __scope_guard guard([&] { va_end(ap); }); + ret = detail::vformat_string(msg, ap); return ret; } |