2 * $Id: arraylist.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
4 * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
5 * Michael Clark <michael@metaparadigm.com>
7 * This library is free software; you can redistribute it and/or modify
8 * it under the terms of the MIT license. See COPYING for details.
14 * @brief Internal methods for working with json_type_array objects.
15 * Although this is exposed by the json_object_get_array() method,
16 * it is not recommended for direct use.
25 #define ARRAY_LIST_DEFAULT_SIZE 32
27 typedef void (array_list_free_fn) (void *data);
34 array_list_free_fn *free_fn;
36 typedef struct array_list array_list;
38 extern struct array_list*
39 array_list_new(array_list_free_fn *free_fn);
42 array_list_free(struct array_list *al);
45 array_list_get_idx(struct array_list *al, size_t i);
48 array_list_put_idx(struct array_list *al, size_t i, void *data);
51 array_list_add(struct array_list *al, void *data);
54 array_list_length(struct array_list *al);
57 array_list_sort(struct array_list *arr, int(*compar)(const void *, const void *));
59 extern void* array_list_bsearch(const void **key,
60 struct array_list *arr,
61 int (*sort_fn)(const void *, const void *));
64 array_list_del_idx(struct array_list *arr, size_t idx, size_t count);