diff options
| author | Magnus Holmgren <magnushol@gmail.com> | 2009-03-08 12:48:58 +0000 |
|---|---|---|
| committer | Magnus Holmgren <magnushol@gmail.com> | 2009-03-08 12:48:58 +0000 |
| commit | f4515c3082dd413017ae06c25d7e85b1dcee30bf (patch) | |
| tree | 1154b2fd5049aa42a1fdd2047effd39e9da1ccaa /apps/codecs/libtremor | |
| parent | 3f69bb2b1d00ccc54e2097fd9da750fcd2f7e11b (diff) | |
| download | rockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.zip rockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.tar.gz rockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.tar.bz2 rockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.tar.xz | |
Add setjmp/longjmp for ARM and ColdFire to the codec lib, and use it in the Vorbis codec to better handle out of memory conditions (to exit rather than crash; the AAC codec could use it too). setjmp/longjmp comes from newlib 1.17.0 with a few minor changes (combine parts of some files, remove support for some architectures, change some ifdef's).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20235 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libtremor')
| -rw-r--r-- | apps/codecs/libtremor/oggmalloc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/codecs/libtremor/oggmalloc.c b/apps/codecs/libtremor/oggmalloc.c index ca917ff..4aa2760 100644 --- a/apps/codecs/libtremor/oggmalloc.c +++ b/apps/codecs/libtremor/oggmalloc.c @@ -1,5 +1,10 @@ #include "os_types.h" +#if defined(CPU_ARM) || defined(CPU_COLDFIRE) +#include <setjmp.h> +extern jmp_buf rb_jump_buf; +#endif + static size_t tmp_ptr; void ogg_malloc_init(void) @@ -16,7 +21,11 @@ void *ogg_malloc(size_t size) size = (size + 3) & ~3; if (mem_ptr + size > tmp_ptr) +#if defined(CPU_ARM) || defined(CPU_COLDFIRE) + longjmp(rb_jump_buf, 1); +#else return NULL; +#endif x = &mallocbuf[mem_ptr]; mem_ptr += size; /* Keep memory 32-bit aligned */ |