Skip to content

Commit

Permalink
Merge pull request #2829 from besser82/feature/json-c_0.12
Browse files Browse the repository at this point in the history
replace obsolete `json_object_object_get` with `json_object_object_get_ex`
  • Loading branch information
Björn Esser committed Apr 24, 2015
2 parents f0e8e93 + 38e580d commit f11fbce
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/shogun/io/SerializableJsonFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ CSerializableJsonFile::new_reader(char* dest_version, size_t n)
const char* ftype;
json_object* buf;

if ((buf = json_object_object_get(
m_stack_stream.back(), STR_KEY_FILETYPE)) == NULL
bool success = json_object_object_get_ex(
m_stack_stream.back(), STR_KEY_FILETYPE, &buf);

if (!success || buf == NULL
|| is_error(buf)
|| (ftype = json_object_get_string(buf)) == NULL)
return NULL;
Expand Down Expand Up @@ -71,18 +73,17 @@ bool
CSerializableJsonFile::get_object_any(
json_object** dest, json_object* src, const char* key)
{
*dest = json_object_object_get(src, key);

return !is_error(*dest);
return json_object_object_get_ex(src, key, & *dest);
}

bool
CSerializableJsonFile::get_object(json_object** dest, json_object* src,
const char* key, json_type t)
{
*dest = json_object_object_get(src, key);
bool success = true ;
success = json_object_object_get_ex(src, key, & *dest);

return *dest != NULL && !is_error(*dest)
return success && *dest != NULL && !is_error(*dest)
&& json_object_is_type(*dest, t);
}

Expand Down

0 comments on commit f11fbce

Please sign in to comment.