Name string is copied and added to flist structure. The original is
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 *l;
unsigned i;
+ pa_assert(name);
if (!size)
size = FLIST_SIZE;
l = pa_xmalloc0(sizeof(pa_flist) + sizeof(pa_flist_elem) * size);
- l->name = name;
+ l->name = pa_xstrdup(name);
l->size = size;
pa_atomic_ptr_store(&l->stored, NULL);
pa_atomic_ptr_store(&l->empty, NULL);
void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
pa_assert(l);
+ pa_assert(l->name);
if (free_cb) {
pa_flist_elem *elem;
typedef struct pa_flist pa_flist;
pa_flist * pa_flist_new(unsigned size);
-/* Freeing the name is responsibility of caller. The name is only used
- * for debug printing. */
+/* Name string is copied and added to flist structure. The original is
+ * responsibility of the caller. The name is only used for debug printing. */
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);