From 0296511f2c958b64a20cfdc32958a41136b68a18 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Fri, 16 Dec 2016 04:39:13 -0800 Subject: [PATCH] YGNodeChildCount -> YGNodeGetChildCount for consistency Summary: I kept wrongly typing this function which is a good sign that the name is inconsistent. Reviewed By: gkassabli Differential Revision: D4333480 fbshipit-source-id: 17058f18fa9e26b3e02f7a1651f7295cae59acad --- YogaKit/UIView+Yoga.m | 8 ++++---- csharp/Facebook.Yoga/Native.cs | 2 +- java/jni/YGJNI.cpp | 2 +- tests/YGLayoutDefaultValuesTest.cpp | 2 +- yoga/Yoga.c | 10 +++++----- yoga/Yoga.h | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/YogaKit/UIView+Yoga.m b/YogaKit/UIView+Yoga.m index 0ad7bddc..241ad33e 100644 --- a/YogaKit/UIView+Yoga.m +++ b/YogaKit/UIView+Yoga.m @@ -53,7 +53,7 @@ - (NSUInteger)yg_numberOfChildren { - return YGNodeChildCount([self ygNode]); + return YGNodeGetChildCount([self ygNode]); } #pragma mark - Setters @@ -295,7 +295,7 @@ static void YGAttachNodesFromViewHierachy(UIView *view) { } BOOL shouldReconstructChildList = NO; - if (YGNodeChildCount(node) != subviewsToInclude.count) { + if (YGNodeGetChildCount(node) != subviewsToInclude.count) { shouldReconstructChildList = YES; } else { for (int i = 0; i < subviewsToInclude.count; i++) { @@ -324,8 +324,8 @@ static void YGRemoveAllChildren(const YGNodeRef node) return; } - while (YGNodeChildCount(node) > 0) { - YGNodeRemoveChild(node, YGNodeGetChild(node, YGNodeChildCount(node) - 1)); + while (YGNodeGetChildCount(node) > 0) { + YGNodeRemoveChild(node, YGNodeGetChild(node, YGNodeGetChildCount(node) - 1)); } } diff --git a/csharp/Facebook.Yoga/Native.cs b/csharp/Facebook.Yoga/Native.cs index fc7df3ca..57cc654f 100644 --- a/csharp/Facebook.Yoga/Native.cs +++ b/csharp/Facebook.Yoga/Native.cs @@ -55,7 +55,7 @@ namespace Facebook.Yoga public static extern IntPtr YGNodeGetChild(IntPtr node, uint index); [DllImport(DllName)] - public static extern uint YGNodeChildCount(IntPtr node); + public static extern uint YGNodeGetChildCount(IntPtr node); [DllImport(DllName)] public static extern void YGNodeCalculateLayout(IntPtr node, diff --git a/java/jni/YGJNI.cpp b/java/jni/YGJNI.cpp index bf17f087..09236b88 100644 --- a/java/jni/YGJNI.cpp +++ b/java/jni/YGJNI.cpp @@ -36,7 +36,7 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) { obj->setFieldValue(topField, YGNodeLayoutGetTop(root)); YGTransferLayoutDirection(root, obj); - for (uint32_t i = 0; i < YGNodeChildCount(root); i++) { + for (uint32_t i = 0; i < YGNodeGetChildCount(root); i++) { YGTransferLayoutOutputsRecursive(YGNodeGetChild(root, i)); } } else { diff --git a/tests/YGLayoutDefaultValuesTest.cpp b/tests/YGLayoutDefaultValuesTest.cpp index fbc1e1b9..044059b5 100644 --- a/tests/YGLayoutDefaultValuesTest.cpp +++ b/tests/YGLayoutDefaultValuesTest.cpp @@ -13,7 +13,7 @@ TEST(YogaTest, assert_default_values) { const YGNodeRef root = YGNodeNew(); - ASSERT_EQ(0, YGNodeChildCount(root)); + ASSERT_EQ(0, YGNodeGetChildCount(root)); ASSERT_EQ(NULL, YGNodeGetChild(root, 1)); ASSERT_EQ(YGDirectionInherit, YGNodeStyleGetDirection(root)); diff --git a/yoga/Yoga.c b/yoga/Yoga.c index 6340d021..dad81116 100644 --- a/yoga/Yoga.c +++ b/yoga/Yoga.c @@ -256,7 +256,7 @@ void YGNodeFree(const YGNodeRef node) { node->parent = NULL; } - const uint32_t childCount = YGNodeChildCount(node); + const uint32_t childCount = YGNodeGetChildCount(node); for (uint32_t i = 0; i < childCount; i++) { const YGNodeRef child = YGNodeGetChild(node, i); child->parent = NULL; @@ -268,7 +268,7 @@ void YGNodeFree(const YGNodeRef node) { } void YGNodeFreeRecursive(const YGNodeRef root) { - while (YGNodeChildCount(root) > 0) { + while (YGNodeGetChildCount(root) > 0) { const YGNodeRef child = YGNodeGetChild(root, 0); YGNodeRemoveChild(root, child); YGNodeFreeRecursive(child); @@ -277,7 +277,7 @@ void YGNodeFreeRecursive(const YGNodeRef root) { } void YGNodeReset(const YGNodeRef node) { - YG_ASSERT(YGNodeChildCount(node) == 0, "Cannot reset a node which still has children attached"); + YG_ASSERT(YGNodeGetChildCount(node) == 0, "Cannot reset a node which still has children attached"); YG_ASSERT(node->parent == NULL, "Cannot reset a node still attached to a parent"); YGNodeListFree(node->children); @@ -303,7 +303,7 @@ void YGNodeSetMeasureFunc(const YGNodeRef node, YGMeasureFunc measureFunc) { if (measureFunc == NULL) { node->measure = NULL; } else { - YG_ASSERT(YGNodeChildCount(node) == 0, + YG_ASSERT(YGNodeGetChildCount(node) == 0, "Cannot set measure function: Nodes with measure functions cannot have children."); node->measure = measureFunc; } @@ -337,7 +337,7 @@ YGNodeRef YGNodeGetParent(const YGNodeRef node) { return node->parent; } -inline uint32_t YGNodeChildCount(const YGNodeRef node) { +inline uint32_t YGNodeGetChildCount(const YGNodeRef node) { return YGNodeListCount(node->children); } diff --git a/yoga/Yoga.h b/yoga/Yoga.h index 79c59a4b..3bb96727 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -65,7 +65,7 @@ WIN_EXPORT void YGNodeInsertChild(const YGNodeRef node, WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child); WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index); WIN_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node); -WIN_EXPORT uint32_t YGNodeChildCount(const YGNodeRef node); +WIN_EXPORT uint32_t YGNodeGetChildCount(const YGNodeRef node); WIN_EXPORT void YGNodeCalculateLayout(const YGNodeRef node, const float availableWidth,