From c6b3e345b4e9c6e8797e2b0e1e2b31eca4d62b73 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 13 Oct 2019 07:33:50 -0500 Subject: hscript: Pass data by reference --- hscript/key.hh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'hscript/key.hh') diff --git a/hscript/key.hh b/hscript/key.hh index 960095c..f1e2647 100644 --- a/hscript/key.hh +++ b/hscript/key.hh @@ -39,8 +39,9 @@ public: * @returns nullptr if data is unparsable, otherwise a pointer to a Key. */ #define UNUSED __attribute__((unused)) - static Key *parseFromData(const std::string data UNUSED, int lineno UNUSED, - int *errors UNUSED, int *warnings UNUSED) { + static Key *parseFromData(const std::string &data UNUSED, + int lineno UNUSED, int *errors UNUSED, + int *warnings UNUSED) { return nullptr; } #undef UNUSED @@ -75,8 +76,8 @@ protected: * @param out Output variable: will contain the value. * @returns true if value is parsed successfully, false otherwise. */ - static bool parse(const std::string what, const std::string where, - const std::string key, bool *out); + static bool parse(const std::string &what, const std::string &where, + const std::string &key, bool *out); public: /*! Determines if the Key is set or not. * @returns true if the Key is truthy, false otherwise. @@ -92,7 +93,8 @@ public: class StringKey : public Key { protected: const std::string _value; - StringKey(int _line, std::string my_str) : Key(_line), _value(my_str) {} + StringKey(int _line, const std::string &my_str) : + Key(_line), _value(my_str) {} public: /*! Retrieve the value of this key. */ -- cgit v1.2.3-70-g09d2