From d38db1292ccc3d4978008c26e6dd2e82cacb8685 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Wed, 20 Feb 2019 12:01:40 -0800 Subject: [PATCH] Use `YGNodeRemoveAllChildren` where appropriate Summary: @public `YGNodeRemoveAllChildren` can be used instead of removing children of a yoga node in a loop. Reviewed By: zats Differential Revision: D14131679 fbshipit-source-id: 6ee31f1e288b9b161c641b5bca4f2c1156d58c38 --- YogaKit/Source/YGLayout.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 94a1e550..35d00b96 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -425,9 +425,7 @@ static void YGRemoveAllChildren(const YGNodeRef node) return; } - while (YGNodeGetChildCount(node) > 0) { - YGNodeRemoveChild(node, YGNodeGetChild(node, YGNodeGetChildCount(node) - 1)); - } + YGNodeRemoveAllChildren(node); } static CGFloat YGRoundPixelValue(CGFloat value)