Don't preallocate child lists

Summary: There is no reason to malloc a list of 4 child pointers for every CSS node eagerly. Instead, we malloc the list (preserving the default size of 4) when we try to put stuff in it.

Reviewed By: emilsjolander

Differential Revision: D4078012

fbshipit-source-id: 7cdcab03ec4067550a5fee5e1baea14344f3a8f9
This commit is contained in:
Scott Wolchok
2016-10-25 17:10:24 -07:00
committed by Facebook Github Bot
parent 0cc1b83569
commit 01c2ac3369
3 changed files with 23 additions and 10 deletions

View File

@@ -24,8 +24,8 @@ typedef struct CSSNodeList *CSSNodeListRef;
CSSNodeListRef CSSNodeListNew(const uint32_t initialCapacity);
void CSSNodeListFree(const CSSNodeListRef list);
uint32_t CSSNodeListCount(const CSSNodeListRef list);
void CSSNodeListAdd(const CSSNodeListRef list, const CSSNodeRef node);
void CSSNodeListInsert(const CSSNodeListRef list, const CSSNodeRef node, const uint32_t index);
void CSSNodeListAdd(CSSNodeListRef *listp, const CSSNodeRef node);
void CSSNodeListInsert(CSSNodeListRef *listp, const CSSNodeRef node, const uint32_t index);
CSSNodeRef CSSNodeListRemove(const CSSNodeListRef list, const uint32_t index);
CSSNodeRef CSSNodeListDelete(const CSSNodeListRef list, const CSSNodeRef node);
CSSNodeRef CSSNodeListGet(const CSSNodeListRef list, const uint32_t index);