aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-07-02 08:41:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-07-02 08:41:02 +0200
commit45c9008b9679aeed32487f065e3e594f320c8b9f (patch)
tree8c1451e03fd20ce3938f3fd57b3aea1b1d05c888 /libbuild2/file.hxx
parent4bab5c56cd1c91a928af73e0d428d8cc361600f4 (diff)
Optimize variable extraction in bootstrap_src()
Diffstat (limited to 'libbuild2/file.hxx')
-rw-r--r--libbuild2/file.hxx19
1 files changed, 8 insertions, 11 deletions
diff --git a/libbuild2/file.hxx b/libbuild2/file.hxx
index 3bceb80..f64f130 100644
--- a/libbuild2/file.hxx
+++ b/libbuild2/file.hxx
@@ -210,27 +210,24 @@ namespace build2
load_root (scope& root);
// Extract the specified variable value from a buildfile. It is expected to
- // be the n'th non-blank/comment line and not to rely on any variable
+ // be the first non-blank/comment line and not to rely on any variable
// expansions other than those from the global scope or any variable
- // overrides. Return in second an indication of whether the variable was
- // found.
+ // overrides. Return nullopt if the variable was not found.
//
- LIBBUILD2_SYMEXPORT pair<value, bool>
- extract_variable (context&, const path&, const variable&, size_t n = 1);
+ LIBBUILD2_SYMEXPORT optional<value>
+ extract_variable (context&, const path&, const variable&);
// As above, but extract from a stream. The path argument is used for
// diagnostics.
//
- LIBBUILD2_SYMEXPORT pair<value, bool>
- extract_variable (context&,
- istream&, const path&,
- const variable&, size_t = 1);
+ LIBBUILD2_SYMEXPORT optional<value>
+ extract_variable (context&, istream&, const path&, const variable&);
// As above, but extract from a lexer (this could be useful for extracting
// from stdin).
//
- LIBBUILD2_SYMEXPORT pair<value, bool>
- extract_variable (context&, lexer&, const variable&, size_t = 1);
+ LIBBUILD2_SYMEXPORT optional<value>
+ extract_variable (context&, lexer&, const variable&);
// Import has two phases: the first is triggered by the import directive in
// the buildfile. It will try to find and load the project. Failed that, it