aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-03 02:56:01 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-03 02:56:01 +0000
commit3f8e86e8ac5db447b75f6863b5e7939492ed4a73 (patch)
treee5af3fd00ee3cdae887d37a1fb4493ee780dac46
parented55ba701e3fdcbc91ee03ed59d44a40ebfc99cb (diff)
downloadpaludis-3f8e86e8ac5db447b75f6863b5e7939492ed4a73.tar.gz
paludis-3f8e86e8ac5db447b75f6863b5e7939492ed4a73.tar.xz
Minor code style cleanups
-rw-r--r--paludis/util/system.cc8
-rw-r--r--paludis/util/virtual_constructor.hh14
2 files changed, 14 insertions, 8 deletions
diff --git a/paludis/util/system.cc b/paludis/util/system.cc
index 8082ecc..09d0910 100644
--- a/paludis/util/system.cc
+++ b/paludis/util/system.cc
@@ -70,7 +70,6 @@ int
paludis::run_command(const std::string & cmd)
{
pid_t child(fork());
- int status(-1);
if (0 == child)
{
Log::get_instance()->message(ll_debug, "execl /bin/sh -c " + cmd);
@@ -78,15 +77,16 @@ paludis::run_command(const std::string & cmd)
throw InternalError(PALUDIS_HERE, "execl failed"); /// \todo fixme
}
else if (-1 == child)
- {
throw InternalError(PALUDIS_HERE, "fork failed"); /// \todo fixme
- }
else
{
+ int status(-1);
if (-1 == wait(&status))
throw InternalError(PALUDIS_HERE, "wait failed"); /// \todo fixme
+ return status;
}
- return status;
+
+ throw InternalError(PALUDIS_HERE, "should never be reached");
}
system_internals::MakeEnvCommand::MakeEnvCommand(const std::string & c,
diff --git a/paludis/util/virtual_constructor.hh b/paludis/util/virtual_constructor.hh
index 5e97763..7da2b7a 100644
--- a/paludis/util/virtual_constructor.hh
+++ b/paludis/util/virtual_constructor.hh
@@ -64,12 +64,18 @@ namespace paludis
/**
* Internal use: called when we cannot find a key.
*/
- ValueType_ handle_not_found(const KeyType_ & k) const
- {
- throw ExceptionType_(k);
- }
+ ValueType_ handle_not_found(const KeyType_ & k) const PALUDIS_ATTRIBUTE((noreturn));
};
};
+
+ template <typename ExceptionType_>
+ template <typename KeyType_, typename ValueType_>
+ ValueType_
+ ThrowException<ExceptionType_>::Parent<KeyType_, ValueType_>::handle_not_found(
+ const KeyType_ & k) const
+ {
+ throw ExceptionType_(k);
+ }
}
/**