diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
commit | 1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch) | |
tree | 4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/platform/Arena.cpp | |
parent | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff) | |
download | external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/platform/Arena.cpp')
-rw-r--r-- | WebCore/platform/Arena.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/WebCore/platform/Arena.cpp b/WebCore/platform/Arena.cpp index 436ab7e..90f850f 100644 --- a/WebCore/platform/Arena.cpp +++ b/WebCore/platform/Arena.cpp @@ -180,24 +180,20 @@ void* ArenaAllocate(ArenaPool *pool, unsigned int nb) printf("Malloc: %d\n", i); #endif a = (Arena*)fastMalloc(sz); - if (a) { - a->limit = (uword)a + sz; - a->base = a->avail = (uword)ARENA_ALIGN(pool, a + 1); - rp = (char *)a->avail; - a->avail += nb; - /* the newly allocated arena is linked after pool->current - * and becomes pool->current */ - a->next = pool->current->next; - pool->current->next = a; - pool->current = a; - if ( !pool->first.next ) - pool->first.next = a; - return(rp); - } + // fastMalloc will abort() if it fails, so we are guaranteed that a is not 0. + a->limit = (uword)a + sz; + a->base = a->avail = (uword)ARENA_ALIGN(pool, a + 1); + rp = (char *)a->avail; + a->avail += nb; + /* the newly allocated arena is linked after pool->current + * and becomes pool->current */ + a->next = pool->current->next; + pool->current->next = a; + pool->current = a; + if ( !pool->first.next ) + pool->first.next = a; + return(rp); } - - /* we got to here, and there's no memory to allocate */ - return(0); } /* --- end ArenaAllocate() --- */ void* ArenaGrow(ArenaPool *pool, void *p, unsigned int size, unsigned int incr) |