diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-20 19:38:38 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-20 19:38:38 -0500 |
commit | 64b7153ce0079f62331a2e66f45c4bbd0c703028 (patch) | |
tree | b16dd8c64511f89c6a9e50d68c707dccc4861b51 /hscript | |
parent | 989cd90d284f3846ef2ca7da3a524a716b4deb2c (diff) | |
download | horizon-64b7153ce0079f62331a2e66f45c4bbd0c703028.tar.gz horizon-64b7153ce0079f62331a2e66f45c4bbd0c703028.tar.bz2 horizon-64b7153ce0079f62331a2e66f45c4bbd0c703028.tar.xz horizon-64b7153ce0079f62331a2e66f45c4bbd0c703028.zip |
hscript: constness fixes for ScriptOptions
Diffstat (limited to 'hscript')
-rw-r--r-- | hscript/script.cc | 8 | ||||
-rw-r--r-- | hscript/script.hh | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/hscript/script.cc b/hscript/script.cc index 5af0fd4..33003bf 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -116,7 +116,7 @@ struct Script::ScriptPrivate { * @param opts Script parsing options. */ bool store_key(const std::string &key_name, Keys::Key *obj, int lineno, - int *errors, int *warnings, ScriptOptions opts) { + int *errors, int *warnings, const ScriptOptions &opts) { if(key_name == "network") { return store_network(obj, lineno, errors, warnings, opts); } else if(key_name == "hostname") { @@ -334,7 +334,8 @@ Script::~Script() { delete internal; } -const Script *Script::load(const std::string path, const ScriptOptions opts) { +const Script *Script::load(const std::string &path, + const ScriptOptions &opts) { std::ifstream file(path); if(!file) { output_error(path, "Cannot open installfile", ""); @@ -345,7 +346,8 @@ const Script *Script::load(const std::string path, const ScriptOptions opts) { } -const Script *Script::load(std::istream &sstream, const ScriptOptions opts) { +const Script *Script::load(std::istream &sstream, + const ScriptOptions &opts) { #define PARSER_ERROR(err_str) \ errors++;\ output_error("installfile:" + std::to_string(lineno),\ diff --git a/hscript/script.hh b/hscript/script.hh index 2d3d5c8..9fd186a 100644 --- a/hscript/script.hh +++ b/hscript/script.hh @@ -58,13 +58,15 @@ public: * @param options Options to use for parsing, validation, and execution. * @return true if the Script could be loaded; false otherwise. */ - static const Script *load(const std::string path, const ScriptOptions options = 0); + static const Script *load(const std::string &path, + const ScriptOptions &options = 0); /*! Load a HorizonScript from the specified stream. * @param stream The stream to load from. * @param options Options to use for parsing, validation, and execution. * @return true if the Script could be loaded; false otherwise. */ - static const Script *load(std::istream &stream, const ScriptOptions options = 0); + static const Script *load(std::istream &stream, + const ScriptOptions &options = 0); /*! Determines if the HorizonScript is valid. */ bool validate() const; |