From 138c2a6b97e0ac49504cff8ad2f83a413028bbc9 Mon Sep 17 00:00:00 2001 From: Mina Naguib Date: Sun, 7 Feb 2016 20:55:25 -0500 Subject: [PATCH] Clarify json_object_get_string documentation of NULL handling & returning --- json_object.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/json_object.h b/json_object.h index 99b8edf..6976250 100644 --- a/json_object.h +++ b/json_object.h @@ -670,14 +670,19 @@ extern struct json_object* json_object_new_string_len(const char *s, int len); /** Get the string value of a json_object * - * If the passed object is not of type json_type_string then the JSON - * representation of the object is returned. + * If the passed object is of type json_type_null (i.e. obj == NULL), + * NULL is returned. + * + * If the passed object of type json_type_string, the string contents + * are returned. + * + * Otherwise the JSON representation of the object is returned. * * The returned string memory is managed by the json_object and will * be freed when the reference count of the json_object drops to zero. * * @param obj the json_object instance - * @returns a string + * @returns a string or NULL */ extern const char* json_object_get_string(struct json_object *obj); -- 2.40.0