fiddle with the alloc requested size instead of the buffer pointer to keep the buffer 32bit aligned
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28175 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
74dbb3c27b
commit
dcc0d7dfdc
1 changed files with 2 additions and 2 deletions
|
@ -45,12 +45,12 @@ void* skin_buffer_alloc(size_t size)
|
||||||
{
|
{
|
||||||
void *retval = NULL;
|
void *retval = NULL;
|
||||||
#ifdef ROCKBOX
|
#ifdef ROCKBOX
|
||||||
|
/* 32-bit aligned */
|
||||||
|
size = (size + 3) & ~3;
|
||||||
if (size > skin_buffer_freespace())
|
if (size > skin_buffer_freespace())
|
||||||
return NULL;
|
return NULL;
|
||||||
retval = buffer_front;
|
retval = buffer_front;
|
||||||
buffer_front += size;
|
buffer_front += size;
|
||||||
/* 32-bit aligned */
|
|
||||||
buffer_front = (void *)(((unsigned long)buffer_front + 3) & ~3);
|
|
||||||
#else
|
#else
|
||||||
retval = malloc(size);
|
retval = malloc(size);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue