From d0f36d7a68b0aa9b71d8bc1127328de3e58160db Mon Sep 17 00:00:00 2001 From: Mingwei Pan Date: Fri, 15 Sep 2017 08:22:36 -0700 Subject: [PATCH] Zero out all fields in YGZeroOutLayoutRecursivly using memset Reviewed By: emilsjolander Differential Revision: D5842351 fbshipit-source-id: d2c2b6f829588a200525b7ccbdb63003cb4dcc4e --- ReactCommon/yoga/yoga/Yoga.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/ReactCommon/yoga/yoga/Yoga.c b/ReactCommon/yoga/yoga/Yoga.c index 15ac45860..84aa5a757 100644 --- a/ReactCommon/yoga/yoga/Yoga.c +++ b/ReactCommon/yoga/yoga/Yoga.c @@ -1865,18 +1865,7 @@ static bool YGNodeFixedSizeSetMeasuredDimensions(const YGNodeRef node, } static void YGZeroOutLayoutRecursivly(const YGNodeRef node) { - node->layout.dimensions[YGDimensionHeight] = 0; - node->layout.dimensions[YGDimensionWidth] = 0; - node->layout.position[YGEdgeTop] = 0; - node->layout.position[YGEdgeBottom] = 0; - node->layout.position[YGEdgeLeft] = 0; - node->layout.position[YGEdgeRight] = 0; - node->layout.cachedLayout.availableHeight = 0; - node->layout.cachedLayout.availableWidth = 0; - node->layout.cachedLayout.heightMeasureMode = YGMeasureModeExactly; - node->layout.cachedLayout.widthMeasureMode = YGMeasureModeExactly; - node->layout.cachedLayout.computedWidth = 0; - node->layout.cachedLayout.computedHeight = 0; + memset(&(node->layout), 0, sizeof(YGLayout)); node->hasNewLayout = true; const uint32_t childCount = YGNodeGetChildCount(node); for (uint32_t i = 0; i < childCount; i++) {