diff options
author | Alexander Klauer <Alexander.Klauer@itwm.fraunhofer.de> | 2013-01-08 14:24:21 +0100 |
---|---|---|
committer | Alexander Klauer <Alexander.Klauer@itwm.fraunhofer.de> | 2013-01-08 14:24:21 +0100 |
commit | 2be921d88376e78f84d79aafa6db2714da804e59 (patch) | |
tree | 1ac0e1fc7f4a3a8a8d3109830e840782465fcd2a /json_object.h | |
parent | 85da28c53420659620bad73943436bb5115c2a4a (diff) | |
download | json-c-2be921d88376e78f84d79aafa6db2714da804e59.tar.gz |
Fixed json_object_object_add().
* Return value of json_object_object_add() changed from void to int.
Return value now indicates success or failure.
* Check whether allocations are successful.
* Do not exit program from within the library.
Diffstat (limited to 'json_object.h')
-rw-r--r-- | json_object.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/json_object.h b/json_object.h index 0ff6584..b7d37fe 100644 --- a/json_object.h +++ b/json_object.h @@ -230,8 +230,11 @@ extern struct lh_table* json_object_get_object(struct json_object *obj); * @param obj the json_object instance * @param key the object field name (a private copy will be duplicated) * @param val a json_object or NULL member to associate with the given field + * + * @return On success, <code>0</code> is returned. + * On error, a negative value is returned. */ -extern void json_object_object_add(struct json_object* obj, const char *key, +extern int json_object_object_add(struct json_object* obj, const char *key, struct json_object *val); /** Get the json_object associate with a given object field |