mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
core: Change sematics of pa_flist_new_with_name() (v1.1)
Name string is copied and added to flist structure. The original is responsibility of the caller. The name is only used for debug printing.
This commit is contained in:
parent
a37e0963ef
commit
34d022c16e
2 changed files with 5 additions and 3 deletions
|
|
@ -83,13 +83,14 @@ static void stack_push(pa_atomic_ptr_t *list, pa_flist_elem *new_elem) {
|
||||||
pa_flist *pa_flist_new_with_name(unsigned size, const char *name) {
|
pa_flist *pa_flist_new_with_name(unsigned size, const char *name) {
|
||||||
pa_flist *l;
|
pa_flist *l;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
pa_assert(name);
|
||||||
|
|
||||||
if (!size)
|
if (!size)
|
||||||
size = FLIST_SIZE;
|
size = FLIST_SIZE;
|
||||||
|
|
||||||
l = pa_xmalloc0(sizeof(pa_flist) + sizeof(pa_flist_elem) * size);
|
l = pa_xmalloc0(sizeof(pa_flist) + sizeof(pa_flist_elem) * size);
|
||||||
|
|
||||||
l->name = name;
|
l->name = pa_xstrdup(name);
|
||||||
l->size = size;
|
l->size = size;
|
||||||
pa_atomic_ptr_store(&l->stored, NULL);
|
pa_atomic_ptr_store(&l->stored, NULL);
|
||||||
pa_atomic_ptr_store(&l->empty, NULL);
|
pa_atomic_ptr_store(&l->empty, NULL);
|
||||||
|
|
@ -105,6 +106,7 @@ pa_flist *pa_flist_new(unsigned size) {
|
||||||
|
|
||||||
void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
|
void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
|
||||||
pa_assert(l);
|
pa_assert(l);
|
||||||
|
pa_assert(l->name);
|
||||||
|
|
||||||
if (free_cb) {
|
if (free_cb) {
|
||||||
pa_flist_elem *elem;
|
pa_flist_elem *elem;
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
typedef struct pa_flist pa_flist;
|
typedef struct pa_flist pa_flist;
|
||||||
|
|
||||||
pa_flist * pa_flist_new(unsigned size);
|
pa_flist * pa_flist_new(unsigned size);
|
||||||
/* Freeing the name is responsibility of caller. The name is only used
|
/* Name string is copied and added to flist structure. The original is
|
||||||
* for debug printing. */
|
* responsibility of the caller. The name is only used for debug printing. */
|
||||||
pa_flist * pa_flist_new_with_name(unsigned size, const char *name);
|
pa_flist * pa_flist_new_with_name(unsigned size, const char *name);
|
||||||
void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb);
|
void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue