1 #ifndef foopulsecoredynarrayhfoo
2 #define foopulsecoredynarrayhfoo
5 This file is part of PulseAudio.
7 Copyright 2004-2008 Lennart Poettering
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 #include <pulsecore/idxset.h>
27 typedef struct pa_dynarray pa_dynarray;
29 /* Implementation of a simple dynamically sized array. The array
30 * expands if required, but doesn't shrink if possible. Memory
31 * management of the array's entries is the user's job. */
33 pa_dynarray* pa_dynarray_new(void);
35 /* Free the array calling the specified function for every entry in
36 * the array. The function may be NULL. */
37 void pa_dynarray_free(pa_dynarray* a, pa_free2_cb_t free_func, void *userdata);
39 /* Store p at position i in the array */
40 void pa_dynarray_put(pa_dynarray*a, unsigned i, void *p);
42 /* Store p a the first free position in the array. Returns the index
43 * of that entry. If entries are removed from the array their position
44 * are not filled any more by this function. */
45 unsigned pa_dynarray_append(pa_dynarray*a, void *p);
47 void *pa_dynarray_get(pa_dynarray*a, unsigned i);
49 unsigned pa_dynarray_size(pa_dynarray*a);