2008-06-27 19:11:28 +02:00
|
|
|
#ifndef foopulsecoredynarrayhfoo
|
|
|
|
|
#define foopulsecoredynarrayhfoo
|
2004-06-19 01:01:09 +00:00
|
|
|
|
2004-07-16 19:56:36 +00:00
|
|
|
/***
|
2006-06-19 21:53:48 +00:00
|
|
|
This file is part of PulseAudio.
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2008-06-27 19:11:28 +02:00
|
|
|
Copyright 2004-2008 Lennart Poettering
|
2007-02-13 15:35:19 +00:00
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is free software; you can redistribute it and/or modify
|
2004-11-14 14:58:54 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
License, or (at your option) any later version.
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is distributed in the hope that it will be useful, but
|
2004-07-16 19:56:36 +00:00
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2004-11-14 14:58:54 +00:00
|
|
|
Lesser General Public License for more details.
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2004-11-14 14:58:54 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2006-06-19 21:53:48 +00:00
|
|
|
License along with PulseAudio; if not, write to the Free Software
|
2004-07-16 19:56:36 +00:00
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
|
USA.
|
|
|
|
|
***/
|
|
|
|
|
|
2011-11-18 09:58:08 +01:00
|
|
|
#include <pulse/def.h>
|
2008-06-27 19:11:28 +02:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
typedef struct pa_dynarray pa_dynarray;
|
2004-06-19 01:01:09 +00:00
|
|
|
|
2013-06-26 16:13:47 +03:00
|
|
|
/* Implementation of a simple dynamically sized array for storing pointers.
|
|
|
|
|
*
|
|
|
|
|
* When the array is created, a free callback can be provided, which will be
|
|
|
|
|
* then used when removing items from the array and when freeing the array. If
|
|
|
|
|
* the free callback is not provided, the memory management of the stored items
|
|
|
|
|
* is the responsibility of the array user. If there is need to remove items
|
|
|
|
|
* from the array without freeing them, while also having the free callback
|
|
|
|
|
* set, the functions with "steal" in their name can be used.
|
|
|
|
|
*
|
|
|
|
|
* Removing items from the middle of the array causes the subsequent items to
|
|
|
|
|
* be moved to fill the gap, so it's not efficient with large arrays. If the
|
|
|
|
|
* order of the array is not important, however, functions with "fast" in their
|
|
|
|
|
* name can be used, in which case the gap is filled by moving only the last
|
|
|
|
|
* item(s). XXX: Currently there are no functions with "fast" in their name,
|
|
|
|
|
* but such functions will be added if they are ever needed.
|
|
|
|
|
*
|
|
|
|
|
* The array doesn't support storing NULL pointers. */
|
|
|
|
|
|
|
|
|
|
pa_dynarray* pa_dynarray_new(pa_free_cb_t free_cb);
|
|
|
|
|
void pa_dynarray_free(pa_dynarray *array);
|
|
|
|
|
|
|
|
|
|
void pa_dynarray_append(pa_dynarray *array, void *p);
|
|
|
|
|
void *pa_dynarray_get(pa_dynarray *array, unsigned i);
|
|
|
|
|
|
|
|
|
|
/* Returns the removed item, or NULL if the array is empty. */
|
|
|
|
|
void *pa_dynarray_steal_last(pa_dynarray *array);
|
|
|
|
|
|
|
|
|
|
unsigned pa_dynarray_size(pa_dynarray *array);
|
2004-06-19 01:01:09 +00:00
|
|
|
|
|
|
|
|
#endif
|