diff --git a/.travis.yml b/.travis.yml index d318d9cc8..132743d34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ - language: cpp compiler: @@ -26,6 +25,7 @@ addons: - pkg-config before_script: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew uninstall libtool; brew install libtool; fi - if [ -n "$USE_SHELL" ]; then export CONFIG_SHELL="$USE_SHELL"; fi - test -n "$USE_SHELL" && eval '"$USE_SHELL" -c "./autogen.sh"' || ./autogen.sh diff --git a/include/univalue.h b/include/univalue.h index e48b905bf..e8ce28351 100644 --- a/include/univalue.h +++ b/include/univalue.h @@ -142,10 +142,10 @@ private: public: // Strict type-specific getters, these throw std::runtime_error if the // value is of unexpected type - std::vector getKeys() const; - std::vector getValues() const; + const std::vector& getKeys() const; + const std::vector& getValues() const; bool get_bool() const; - std::string get_str() const; + const std::string& get_str() const; int get_int() const; int64_t get_int64() const; double get_real() const; diff --git a/lib/univalue.cpp b/lib/univalue.cpp index 1f8cee6d2..5a2860c13 100644 --- a/lib/univalue.cpp +++ b/lib/univalue.cpp @@ -283,14 +283,14 @@ const UniValue& find_value(const UniValue& obj, const std::string& name) return NullUniValue; } -std::vector UniValue::getKeys() const +const std::vector& UniValue::getKeys() const { if (typ != VOBJ) throw std::runtime_error("JSON value is not an object as expected"); return keys; } -std::vector UniValue::getValues() const +const std::vector& UniValue::getValues() const { if (typ != VOBJ && typ != VARR) throw std::runtime_error("JSON value is not an object or array as expected"); @@ -304,7 +304,7 @@ bool UniValue::get_bool() const return getBool(); } -std::string UniValue::get_str() const +const std::string& UniValue::get_str() const { if (typ != VSTR) throw std::runtime_error("JSON value is not a string as expected");