From 3f376e8ccc1b8f0a4474d64d25926f344ddcf7d2 Mon Sep 17 00:00:00 2001 From: davidrr Date: Fri, 14 Aug 2015 06:52:52 +0000 Subject: [PATCH] code cleanup git-svn-id: https://svn.code.sf.net/p/porg/code/trunk@157 8854956c-c02d-4db9-8198-7e99b8e08f37 --- lib/porg/common.cc | 2 +- porg/db.cc | 6 ++---- porg/out.cc | 8 +++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/porg/common.cc b/lib/porg/common.cc index e04287e..6a80bbb 100644 --- a/lib/porg/common.cc +++ b/lib/porg/common.cc @@ -110,7 +110,7 @@ string strip_repeated(string const& str, char c) // -// Strip trailing occurrences of character i@c in @str. If all characters in +// Strip trailing occurrences of character @c in @str. If all characters in // @str are @c, leave one of them unstripped. // string Porg::strip_trailing(string const& str, char c) diff --git a/porg/db.cc b/porg/db.cc index 7f2fea5..e7a3580 100644 --- a/porg/db.cc +++ b/porg/db.cc @@ -70,10 +70,8 @@ void DB::get_pkgs(vector const& args) bool found = false; - for (string name; dir.read(name); ) { - if (match_pkg(args[i], name) && add_pkg(name)) - found = true; - } + for (string name; dir.read(name); ) + found |= (match_pkg(args[i], name) && add_pkg(name)); if (!found) { Out::vrb("porg: " + args[i] + ": Package not logged"); diff --git a/porg/out.cc b/porg/out.cc index 8f8912d..b3b59b1 100644 --- a/porg/out.cc +++ b/porg/out.cc @@ -21,11 +21,9 @@ void Out::vrb(string const& msg, int errno_ /* = 0 */) { if (verbose()) { if (errno_) - cerr << "porg: "; - cerr << msg; - if (errno_) - cerr << ": " << strerror(errno_); - cerr << '\n'; + cerr << "porg: " << msg << ": " << strerror(errno_) << "\n"; + else + cerr << msg << "\n"; } }