diff options
| author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2020-07-12 17:55:46 +0000 |
|---|---|---|
| committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2020-07-12 17:55:46 +0000 |
| commit | 2330c6f0de57356066881e1cdf1194ec03cdf01e (patch) | |
| tree | b5fb6aca4cb5ee4a8174554aa631104974eec71a | |
| parent | 6542d33cd1e546f9e58e7cba93049e2858ec9dc2 (diff) | |
| download | json-c-2330c6f0de57356066881e1cdf1194ec03cdf01e.tar.gz | |
Expand the doc for json_object_array_get_idx() to explain that it does not adjust refcounts.
| -rw-r--r-- | json_object.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/json_object.h b/json_object.h index 909c436..4121bf5 100644 --- a/json_object.h +++ b/json_object.h @@ -593,7 +593,15 @@ JSON_EXPORT int json_object_array_add(struct json_object *obj, struct json_objec JSON_EXPORT int json_object_array_put_idx(struct json_object *obj, size_t idx, struct json_object *val); -/** Get the element at specified index of the array (a json_object of type json_type_array) +/** Get the element at specified index of array `obj` (which must be a json_object of type json_type_array) + * + * *No* reference counts will be changed, and ownership of the returned + * object remains with `obj`. See json_object_object_get() for additional + * implications of this behavior. + * + * Calling this with anything other than a json_type_array will trigger + * an assert. + * * @param obj the json_object instance * @param idx the index to get the element at * @returns the json_object at the specified index (or NULL) |
