Skip to content

Commit 2ca7faa

Browse files
author
MarcoFalke
committed
Squashed 'src/univalue/' changes from daf1285..16a1f7f
16a1f7f Merge #3: Pull upstream 3f03bfd Merge pull request #27 from laanwj/2016_09_const_refs 5668ca3 Return const references from getKeys, getValues, get_str cedda14 Merge pull request #28 from MarcoFalke/patch-1 9f0b997 [travis] Work around osx libtool issue git-subtree-dir: src/univalue git-subtree-split: 16a1f7f
1 parent 3650668 commit 2ca7faa

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
language: cpp
32

43
compiler:
@@ -26,6 +25,7 @@ addons:
2625
- pkg-config
2726

2827
before_script:
28+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew uninstall libtool; brew install libtool; fi
2929
- if [ -n "$USE_SHELL" ]; then export CONFIG_SHELL="$USE_SHELL"; fi
3030
- test -n "$USE_SHELL" && eval '"$USE_SHELL" -c "./autogen.sh"' || ./autogen.sh
3131

include/univalue.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ class UniValue {
142142
public:
143143
// Strict type-specific getters, these throw std::runtime_error if the
144144
// value is of unexpected type
145-
std::vector<std::string> getKeys() const;
146-
std::vector<UniValue> getValues() const;
145+
const std::vector<std::string>& getKeys() const;
146+
const std::vector<UniValue>& getValues() const;
147147
bool get_bool() const;
148-
std::string get_str() const;
148+
const std::string& get_str() const;
149149
int get_int() const;
150150
int64_t get_int64() const;
151151
double get_real() const;

lib/univalue.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,14 @@ const UniValue& find_value(const UniValue& obj, const std::string& name)
283283
return NullUniValue;
284284
}
285285

286-
std::vector<std::string> UniValue::getKeys() const
286+
const std::vector<std::string>& UniValue::getKeys() const
287287
{
288288
if (typ != VOBJ)
289289
throw std::runtime_error("JSON value is not an object as expected");
290290
return keys;
291291
}
292292

293-
std::vector<UniValue> UniValue::getValues() const
293+
const std::vector<UniValue>& UniValue::getValues() const
294294
{
295295
if (typ != VOBJ && typ != VARR)
296296
throw std::runtime_error("JSON value is not an object or array as expected");
@@ -304,7 +304,7 @@ bool UniValue::get_bool() const
304304
return getBool();
305305
}
306306

307-
std::string UniValue::get_str() const
307+
const std::string& UniValue::get_str() const
308308
{
309309
if (typ != VSTR)
310310
throw std::runtime_error("JSON value is not a string as expected");

0 commit comments

Comments
 (0)