Skip to content

Commit

Permalink
YGNodeChildCount -> YGNodeGetChildCount for consistency
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Emil Sjolander authored and facebook-github-bot committed Dec 16, 2016
1 parent 04fe81f commit 0296511
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions YogaKit/UIView+Yoga.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ - (BOOL)yg_includeInLayout

- (NSUInteger)yg_numberOfChildren
{
return YGNodeChildCount([self ygNode]);
return YGNodeGetChildCount([self ygNode]);
}

#pragma mark - Setters
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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));
}
}

Expand Down
2 changes: 1 addition & 1 deletion csharp/Facebook.Yoga/Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static extern bool YGIsExperimentalFeatureEnabled(
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,
Expand Down
2 changes: 1 addition & 1 deletion java/jni/YGJNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/YGLayoutDefaultValuesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
10 changes: 5 additions & 5 deletions yoga/Yoga.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion yoga/Yoga.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0296511

Please sign in to comment.