summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/Arena.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
commit1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch)
tree4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/platform/Arena.cpp
parent9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff)
downloadexternal_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.cpp30
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)