From 62a688e3fd7d1fdb8ce5590ebe9cb99e90cbe5d7 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 14 Nov 2019 10:50:41 +0300 Subject: Make use of butl::to_stream(ostream, path, bool) --- libbuild2/config/utility.cxx | 5 ++++- libbuild2/name.cxx | 7 ++----- libbuild2/scope.hxx | 4 +++- libbuild2/target.cxx | 6 ++++-- libbuild2/utility.cxx | 7 ++++--- libbuild2/utility.hxx | 3 ++- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/libbuild2/config/utility.cxx b/libbuild2/config/utility.cxx index 56c1f79..291bf0c 100644 --- a/libbuild2/config/utility.cxx +++ b/libbuild2/config/utility.cxx @@ -195,7 +195,10 @@ namespace build2 ofs << "amalgamation ="; if (!amal->empty ()) - ofs << ' ' << amal->representation (); + { + ofs << ' '; + to_stream (ofs, *amal, true /* representation */); + } ofs << endl; } diff --git a/libbuild2/name.cxx b/libbuild2/name.cxx index 84e03db..9b76327 100644 --- a/libbuild2/name.cxx +++ b/libbuild2/name.cxx @@ -110,13 +110,10 @@ namespace build2 auto write_dir = [dv, quote, &os, &write_string] (const dir_path& d) { - const string& s (dv < 1 - ? diag_relative (d) - : d.representation ()); if (quote) - write_string (s); + write_string (dv < 1 ? diag_relative (d) : d.representation ()); else - os << s; + os << d; }; // Note: similar to to_string() below. diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx index cd8fcb2..2ed8f18 100644 --- a/libbuild2/scope.hxx +++ b/libbuild2/scope.hxx @@ -412,7 +412,9 @@ namespace build2 inline ostream& operator<< (ostream& os, const scope& s) { - return os << s.out_path ().representation (); // Always absolute. + // Always absolute. + // + return to_stream (os, s.out_path (), true /* representation */); } // Return the src/out directory corresponding to the given out/src. The diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx index e4218ed..23e6c9c 100644 --- a/libbuild2/target.cxx +++ b/libbuild2/target.cxx @@ -506,7 +506,7 @@ namespace build2 if (dv < 1) os << diag_relative (pd); else - os << pd.representation (); + to_stream (os, pd, true /* representation */); } const target_type& tt (*k.type); @@ -535,7 +535,9 @@ namespace build2 assert (!k.ext); } else - os << (rd.empty () ? dir_path (".") : rd.leaf ()).representation (); + to_stream (os, + rd.empty () ? dir_path (".") : rd.leaf (), + true /* representation */); os << '}'; diff --git a/libbuild2/utility.cxx b/libbuild2/utility.cxx index 528b435..8e38213 100644 --- a/libbuild2/utility.cxx +++ b/libbuild2/utility.cxx @@ -39,9 +39,10 @@ namespace std { using namespace build2; - return os << (stream_verb (os).path < 1 - ? diag_relative (p) - : p.representation ()); + if (stream_verb (os).path < 1) + return os << diag_relative (p); + else + return to_stream (os, p, true /* representation */); } ostream& diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx index 23ad19b..5c6e984 100644 --- a/libbuild2/utility.hxx +++ b/libbuild2/utility.hxx @@ -16,7 +16,8 @@ #include -#include // combine_hash(), reverse_iterate(), etc +#include // combine_hash(), reverse_iterate(), etc +#include #include -- cgit v1.1