Browse Source

json_object.h:document json_object_new_string_len()

I also added a couple trivial, but related, suggestions.

closes #460
tags/json-c-0.14-20200419
andy5995 6 years ago
parent
commit
3b108935d0
No known key found for this signature in database GPG Key ID: 6BFEC9B82603CAF
2 changed files with 13 additions and 2 deletions
  1. +1
    -1
      json_object.c
  2. +12
    -1
      json_object.h

+ 1
- 1
json_object.c View File

@@ -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);


+ 12
- 1
json_object.h View File

@@ -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
*


Loading…
Cancel
Save