diff options
author | Frederik Deweerdt <frederik.deweerdt@gmail.com> | 2011-10-07 21:07:18 +0200 |
---|---|---|
committer | Frederik Deweerdt <frederik.deweerdt@gmail.com> | 2011-10-07 21:07:18 +0200 |
commit | c43871c86693f34ae143da2d53a3370c670e5554 (patch) | |
tree | 8d7caf42bafaf5db6c998ab1bd0a44fa54bc1693 /json_object.h | |
parent | a8ffbe97b0414ce62fd2d697dcf9e76c7514362a (diff) |
Add new json_object_array_sort function
- uses libc's qsort to sort the arraylist
- add test in test1.c
Diffstat (limited to 'json_object.h')
-rw-r--r-- | json_object.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/json_object.h b/json_object.h index 9f9ca40..d56d12c 100644 --- a/json_object.h +++ b/json_object.h @@ -195,6 +195,16 @@ extern struct array_list* json_object_get_array(struct json_object *obj); */ extern int json_object_array_length(struct json_object *obj); +/** Sorts the elements of jso of type json_type_array +* +* Pointers to the json_object pointers will be passed as the two arguments +* to @sort_fn +* +* @param obj the json_object instance +* @param sort_fn a sorting function +*/ +extern void json_object_array_sort(struct json_object *jso, int(*sort_fn)(const void *, const void *)); + /** Add an element to the end of a json_object of type json_type_array * * The reference count will *not* be incremented. This is to make adding |