From 3b108935d0f92df49ec79cfcb6189e982302ebca Mon Sep 17 00:00:00 2001 From: andy5995 Date: Tue, 27 Nov 2018 11:35:45 -0600 Subject: [PATCH 1/2] json_object.h:document json_object_new_string_len() I also added a couple trivial, but related, suggestions. closes #460 --- json_object.c | 2 +- json_object.h | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/json_object.c b/json_object.c index 8a86bc6..c5dd1b4 100644 --- a/json_object.c +++ b/json_object.c @@ -1030,7 +1030,7 @@ struct json_object* json_object_new_string(const char *s) return jso; } -struct json_object* json_object_new_string_len(const char *s, int len) +struct json_object* json_object_new_string_len(const char *s, const int len) { char *dstbuf; struct json_object *jso = json_object_new(json_type_string); diff --git a/json_object.h b/json_object.h index a026320..f7acaf7 100644 --- a/json_object.h +++ b/json_object.h @@ -899,10 +899,21 @@ JSON_EXPORT int json_object_set_double(struct json_object *obj,double new_value) * * @param s the string * @returns a json_object of type json_type_string + * @see json_object_new_string_len() */ JSON_EXPORT struct json_object* json_object_new_string(const char *s); -JSON_EXPORT struct json_object* json_object_new_string_len(const char *s, int len); +/** Create a new empty json_object of type json_type_string and allocate + * len characters for the new string. + * + * A copy of the string is made and the memory is managed by the json_object + * + * @param[in] s the string + * @param[in] len max length of the new string + * @returns a json_object of type json_type_string + * @see json_object_new_string() + */ +JSON_EXPORT struct json_object* json_object_new_string_len(const char *s, const int len); /** Get the string value of a json_object * From 2942870325da9979ff4842962d6d0ab52d5dbf81 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Wed, 28 Nov 2018 16:55:19 -0600 Subject: [PATCH 2/2] remove [in] from params description Keeping this would be inconsistent with the other documentation --- json_object.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json_object.h b/json_object.h index f7acaf7..c4a9cb2 100644 --- a/json_object.h +++ b/json_object.h @@ -908,8 +908,8 @@ JSON_EXPORT struct json_object* json_object_new_string(const char *s); * * A copy of the string is made and the memory is managed by the json_object * - * @param[in] s the string - * @param[in] len max length of the new string + * @param s the string + * @param len max length of the new string * @returns a json_object of type json_type_string * @see json_object_new_string() */