From de04a22086d9790b5e91bd3c0684f18baa9ac6e1 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 19 Sep 2009 18:23:44 -0700 Subject: [PATCH] Fiddle C++ stream idiom. --- libdw/c++/subr.hh | 4 +--- libdw/c++/values.cc | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/libdw/c++/subr.hh b/libdw/c++/subr.hh index 896ad7a73..bc76d5702 100644 --- a/libdw/c++/subr.hh +++ b/libdw/c++/subr.hh @@ -187,9 +187,7 @@ namespace elfutils static inline std::string hex_string (int code) { std::ostringstream os; - os.setf (std::ios::hex, std::ios::basefield); - os.setf (std::ios::showbase); - os << code; + os << std::hex << std::showbase << code; return os.str (); } diff --git a/libdw/c++/values.cc b/libdw/c++/values.cc index 8f97a98f7..66fffc128 100644 --- a/libdw/c++/values.cc +++ b/libdw/c++/values.cc @@ -147,9 +147,7 @@ static string hex_string (Dwarf_Word value, const char *before = "", const char *after = "") { std::ostringstream os; - os.setf (std::ios::hex, std::ios::basefield); - os.setf (std::ios::showbase); - os << before << value << after; + os << std::hex << std::showbase << before << value << after; return os.str (); } @@ -478,10 +476,8 @@ string __libdw_ranges_to_string (const container &c) { std::ostringstream os; - os.setf (std::ios::hex, std::ios::basefield); - os.setf (std::ios::showbase); - os << "<"; + os << "<" << std::hex << std::showbase; bool first = true; for (typename container::const_iterator i = c.begin (); i != c.end (); ++i) -- 2.47.3