From 0a401f2ff037a35f779b21a2fdb5974c7396e9ef Mon Sep 17 00:00:00 2001 From: "Øyvind A. Holm" Date: Mon, 17 Apr 2017 00:02:01 +0200 Subject: Remove compiler warning about missing braces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the following warning from gcc 5.4.0: "[...]/src/output.cc:335:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]". Instead of adding braces around the whole function body, return early if item.metadata is 0. --- src/output.cc | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/output.cc b/src/output.cc index c6c8ecd7..2a8c8201 100644 --- a/src/output.cc +++ b/src/output.cc @@ -332,18 +332,19 @@ void report_tags::flush() void report_tags::gather_metadata(item_t& item) { - if (item.metadata) - foreach (const item_t::string_map::value_type& data, *item.metadata) { - string tag(data.first); - if (report.HANDLED(values) && data.second.first) - tag += ": " + data.second.first.get().to_string(); - - std::map::iterator i = tags.find(tag); - if (i == tags.end()) - tags.insert(tags_pair(tag, 1)); - else - (*i).second++; - } + if (! item.metadata) + return; + foreach (const item_t::string_map::value_type& data, *item.metadata) { + string tag(data.first); + if (report.HANDLED(values) && data.second.first) + tag += ": " + data.second.first.get().to_string(); + + std::map::iterator i = tags.find(tag); + if (i == tags.end()) + tags.insert(tags_pair(tag, 1)); + else + (*i).second++; + } } void report_tags::operator()(post_t& post) -- cgit v1.2.3