diff options
author | Øyvind A. Holm <sunny@sunbase.org> | 2017-04-17 00:02:01 +0200 |
---|---|---|
committer | Øyvind A. Holm <sunny@sunbase.org> | 2017-04-17 00:02:01 +0200 |
commit | 0a401f2ff037a35f779b21a2fdb5974c7396e9ef (patch) | |
tree | c2f19525c5d9e66ff727c0bb2df33c698d2160da /src/output.cc | |
parent | b41454477a0576952f77a20ee32c38eb1b9c1442 (diff) | |
download | fork-ledger-0a401f2ff037a35f779b21a2fdb5974c7396e9ef.tar.gz fork-ledger-0a401f2ff037a35f779b21a2fdb5974c7396e9ef.tar.bz2 fork-ledger-0a401f2ff037a35f779b21a2fdb5974c7396e9ef.zip |
Remove compiler warning about missing braces
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.
Diffstat (limited to 'src/output.cc')
-rw-r--r-- | src/output.cc | 25 |
1 files changed, 13 insertions, 12 deletions
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<string, std::size_t>::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<string, std::size_t>::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) |