Reformat json_object_object_get() and json_object_object_get_ex().

This commit is contained in:
Eric Haszlakiewicz
2012-10-18 17:16:36 -05:00
parent 5450bed051
commit e36e562872

View File

@@ -390,9 +390,9 @@ void json_object_object_add(struct json_object* jso, const char *key,
struct json_object* json_object_object_get(struct json_object* jso, const char *key) struct json_object* json_object_object_get(struct json_object* jso, const char *key)
{ {
struct json_object *result = NULL; struct json_object *result = NULL;
json_object_object_get_ex(jso, key, &result); json_object_object_get_ex(jso, key, &result);
return result; return result;
} }
json_bool json_object_object_get_ex(struct json_object* jso, const char *key, struct json_object **value) json_bool json_object_object_get_ex(struct json_object* jso, const char *key, struct json_object **value)
@@ -400,17 +400,18 @@ json_bool json_object_object_get_ex(struct json_object* jso, const char *key, st
if (value != NULL) if (value != NULL)
*value = NULL; *value = NULL;
if (NULL == jso) return FALSE; if (NULL == jso)
return FALSE;
switch(jso->o_type) { switch(jso->o_type)
case json_type_object: {
return lh_table_lookup_ex(jso->o.c_object, (void*)key, (void**)value); case json_type_object:
default: return lh_table_lookup_ex(jso->o.c_object, (void*)key, (void**)value);
if (value != NULL) { default:
*value = NULL; if (value != NULL)
} *value = NULL;
return FALSE; return FALSE;
} }
} }
void json_object_object_del(struct json_object* jso, const char *key) void json_object_object_del(struct json_object* jso, const char *key)