]>
code.delx.au - pulseaudio/blob - polyp/memblock.h
1 #ifndef foomemblockhfoo
2 #define foomemblockhfoo
7 This file is part of polypaudio.
9 polypaudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 2 of the License,
12 or (at your option) any later version.
14 polypaudio 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 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with polypaudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 #include <sys/types.h>
28 enum pa_memblock_type
{ PA_MEMBLOCK_FIXED
, PA_MEMBLOCK_APPENDED
, PA_MEMBLOCK_DYNAMIC
, PA_MEMBLOCK_USER
};
30 struct pa_memblock_stat
;
33 enum pa_memblock_type type
;
37 void (*free_cb
)(void *p
);
38 struct pa_memblock_stat
*stat
;
41 struct pa_memblock
*pa_memblock_new(size_t length
, struct pa_memblock_stat
*s
);
42 struct pa_memblock
*pa_memblock_new_fixed(void *data
, size_t length
, struct pa_memblock_stat
*s
);
43 struct pa_memblock
*pa_memblock_new_dynamic(void *data
, size_t length
, struct pa_memblock_stat
*s
);
44 struct pa_memblock
*pa_memblock_new_user(void *data
, size_t length
, void (*free_cb
)(void *p
), struct pa_memblock_stat
*s
);
46 void pa_memblock_unref(struct pa_memblock
*b
);
47 struct pa_memblock
* pa_memblock_ref(struct pa_memblock
*b
);
49 void pa_memblock_unref_fixed(struct pa_memblock
*b
);
51 struct pa_memblock_stat
{
56 unsigned allocated_size
;
59 struct pa_memblock_stat
* pa_memblock_stat_new(void);
60 void pa_memblock_stat_unref(struct pa_memblock_stat
*s
);
61 struct pa_memblock_stat
* pa_memblock_stat_ref(struct pa_memblock_stat
*s
);