forked from len0rd/rockbox
rbcodec: abstract tdspeed buffer allocation
Move code dealing with rockbox specific buflib allocations into a rockbox specific file and implement buffer allocation with malloc/free for warble/stand alone lib. Based on patch by Sean Bartell. Change-Id: I8cb85dad5890fbd34c1bb26abbb89c0b0f6b55cf Reviewed-on: http://gerrit.rockbox.org/144 Tested-by: Nils Wallménius <nils@rockbox.org> Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Reviewed-by: Nils Wallménius <nils@rockbox.org>
This commit is contained in:
parent
51a73d81cd
commit
3f61caa0cd
8 changed files with 173 additions and 110 deletions
|
@ -74,4 +74,27 @@ static inline off_t filesize(int fd) {
|
|||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
static inline bool tdspeed_alloc_buffers(int32_t **buffers,
|
||||
const int *buf_s, int nbuf)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nbuf; i++)
|
||||
{
|
||||
buffers[i] = malloc(buf_s[i]);
|
||||
if (!buffers[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void tdspeed_free_buffers(int32_t **buffers, int nbuf)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nbuf; i++)
|
||||
{
|
||||
free(buffers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue