File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ class UniValue {
123
123
const UniValue& get_array () const ;
124
124
125
125
enum VType type () const { return getType (); }
126
- friend const UniValue& find_value ( const UniValue& obj, const std::string& name) ;
126
+ const UniValue& find_value (std::string_view key) const ;
127
127
};
128
128
129
129
template <class It >
@@ -201,6 +201,6 @@ static inline bool json_isspace(int ch)
201
201
202
202
extern const UniValue NullUniValue;
203
203
204
- const UniValue& find_value ( const UniValue& obj, const std::string& name);
204
+ inline const UniValue& find_value (const UniValue& obj, const std::string& name) { return obj. find_value (name); }
205
205
206
206
#endif // BITCOIN_UNIVALUE_INCLUDE_UNIVALUE_H
Original file line number Diff line number Diff line change @@ -230,12 +230,13 @@ const char *uvTypeName(UniValue::VType t)
230
230
return nullptr ;
231
231
}
232
232
233
- const UniValue& find_value (const UniValue& obj, const std::string& name)
233
+ const UniValue& UniValue:: find_value (std::string_view key) const
234
234
{
235
- for (unsigned int i = 0 ; i < obj.keys .size (); i++)
236
- if (obj.keys [i] == name)
237
- return obj.values .at (i);
238
-
235
+ for (unsigned int i = 0 ; i < keys.size (); ++i) {
236
+ if (keys[i] == key) {
237
+ return values.at (i);
238
+ }
239
+ }
239
240
return NullUniValue;
240
241
}
241
242
You can’t perform that action at this time.
0 commit comments