aboutsummaryrefslogtreecommitdiff
path: root/libbbot/build-config.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbbot/build-config.cxx')
-rw-r--r--libbbot/build-config.cxx31
1 files changed, 9 insertions, 22 deletions
diff --git a/libbbot/build-config.cxx b/libbbot/build-config.cxx
index f18c48a..855b093 100644
--- a/libbbot/build-config.cxx
+++ b/libbbot/build-config.cxx
@@ -63,39 +63,26 @@ namespace bbot
// Make sure the name is unique.
//
for (const auto& c: r)
+ {
if (c.name == config.name)
bad_line ("duplicate configuration name");
+ }
- // If there is no target nor configuration variables then save the
- // configuration and proceed with the next line.
- //
if (++i == n)
+ bad_line ("no target found");
+
+ try
{
- r.emplace_back (move (config));
- continue;
+ config.target = target_triplet (tl[i].value);
}
-
- // If the third field doesn't start with '~' character and doesn't
- // contain '=' character, then we will treat it as a target.
- //
- const string& v (tl[i].value);
- if (v[0] != '~' && v.find ('=') == string::npos)
+ catch (const invalid_argument& e)
{
- try
- {
- config.target = target_triplet (v);
- }
- catch (const invalid_argument& e)
- {
- bad_line (e.what ());
- }
-
- ++i;
+ bad_line (e.what ());
}
try
{
- for (; i < n; ++i)
+ for (++i; i < n; ++i)
{
string& v (tl[i].value);