aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src/filesystem/error.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/src/filesystem/error.h')
-rw-r--r--libcxx/src/filesystem/error.h26
1 files changed, 4 insertions, 22 deletions
diff --git a/libcxx/src/filesystem/error.h b/libcxx/src/filesystem/error.h
index 52a18b2..db5d1ae 100644
--- a/libcxx/src/filesystem/error.h
+++ b/libcxx/src/filesystem/error.h
@@ -128,17 +128,8 @@ struct ErrorHandler {
T report(const error_code& ec, const char* msg, ...) const {
va_list ap;
va_start(ap, msg);
-#if _LIBCPP_HAS_EXCEPTIONS
- try {
-#endif // _LIBCPP_HAS_EXCEPTIONS
- report_impl(ec, msg, ap);
-#if _LIBCPP_HAS_EXCEPTIONS
- } catch (...) {
- va_end(ap);
- throw;
- }
-#endif // _LIBCPP_HAS_EXCEPTIONS
- va_end(ap);
+ __scope_guard guard([&] { va_end(ap); });
+ report_impl(ec, msg, ap);
return error_value<T>();
}
@@ -148,17 +139,8 @@ struct ErrorHandler {
T report(errc const& err, const char* msg, ...) const {
va_list ap;
va_start(ap, msg);
-#if _LIBCPP_HAS_EXCEPTIONS
- try {
-#endif // _LIBCPP_HAS_EXCEPTIONS
- report_impl(make_error_code(err), msg, ap);
-#if _LIBCPP_HAS_EXCEPTIONS
- } catch (...) {
- va_end(ap);
- throw;
- }
-#endif // _LIBCPP_HAS_EXCEPTIONS
- va_end(ap);
+ __scope_guard guard([&] { va_end(ap); });
+ report_impl(make_error_code(err), msg, ap);
return error_value<T>();
}