diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2025-02-03 06:46:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2025-02-03 06:48:19 +0200 |
commit | 43eb1e43b6b22a0343104387431db7f32a88b16c (patch) | |
tree | 15b90b59ac4748bfa923190eb91952b5a613992b /libbuild2/variable.cxx | |
parent | 4ed0fe15d139748784adb40841028b36704b2f4f (diff) |
Optimize maybe-used diag_record
It turns out the std::ostringstream member of butl::diag_record is quite
expensive to construct but to never use.
Diffstat (limited to 'libbuild2/variable.cxx')
-rw-r--r-- | libbuild2/variable.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx index 0abc360..086fa7a 100644 --- a/libbuild2/variable.cxx +++ b/libbuild2/variable.cxx @@ -1872,8 +1872,8 @@ namespace build2 // // Note: the same diagnostics as in $json.serialize(). // - diag_record dr; - dr << fail << "invalid json value: " << e; + diag_record dr (fail); + dr << "invalid json value: " << e; if (e.event) dr << info << "while serializing " << to_string (*e.event); @@ -2099,8 +2099,8 @@ namespace build2 // We will likely be trying to interpret a member name as an integer // due to the incorrect value type so issue appropriate diagnostics. // - diag_record dr; - dr << fail (sloc) << "invalid json value subscript: " << e; + diag_record dr (fail (sloc)); + dr << "invalid json value subscript: " << e; if (jv != nullptr && jv->type != json_type::object) dr << info << "json value type is " << jv->type; |