mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Implement custom assert macro
Reviewed By: javache Differential Revision: D3648805 fbshipit-source-id: a6bf1bb55e1e0ee37284647ab76d66f3956a66c0
This commit is contained in:
committed by
Facebook Github Bot
parent
2d168fcd61
commit
f94e4348dd
@@ -17,12 +17,12 @@ struct CSSNodeList {
|
||||
|
||||
CSSNodeListRef CSSNodeListNew(uint32_t initialCapacity) {
|
||||
CSSNodeListRef list = malloc(sizeof(struct CSSNodeList));
|
||||
assert(list != NULL);
|
||||
CSS_ASSERT(list != NULL, "Could not allocate memory for list");
|
||||
|
||||
list->capacity = initialCapacity;
|
||||
list->count = 0;
|
||||
list->items = malloc(sizeof(void*) * list->capacity);
|
||||
assert(list->items != NULL);
|
||||
CSS_ASSERT(list->items != NULL, "Could not allocate memory for items");
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ void CSSNodeListInsert(CSSNodeListRef list, CSSNodeRef node, uint32_t index) {
|
||||
if (list->count == list->capacity) {
|
||||
list->capacity *= 2;
|
||||
list->items = realloc(list->items, sizeof(void*) * list->capacity);
|
||||
assert(list->items != NULL);
|
||||
CSS_ASSERT(list->items != NULL, "Could not extend allocation for items");
|
||||
}
|
||||
|
||||
for (uint32_t i = list->count; i > index; i--) {
|
||||
|
||||
Reference in New Issue
Block a user