dedup code

This commit is contained in:
Lukas Woehrl
2016-12-21 07:25:23 +01:00
parent 7e4a6f0e64
commit 34c97b03f6

View File

@@ -417,16 +417,6 @@ inline float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
return 0.0f; return 0.0f;
} }
inline YGValue YGNodeStyleGetFlexBasis(const YGNodeRef node) {
if (node->style.flexBasis.isDefined) {
return node->style.flexBasis;
}
if (!YGFloatIsUndefined(node->style.flex) && node->style.flex > 0.0f) {
return YGValueZero;
}
return YGValueUndefined;
}
static inline const YGValue * YGNodeStyleGetFlexBasisPtr(const YGNodeRef node) { static inline const YGValue * YGNodeStyleGetFlexBasisPtr(const YGNodeRef node) {
if (node->style.flexBasis.isDefined) { if (node->style.flexBasis.isDefined) {
return &node->style.flexBasis; return &node->style.flexBasis;
@@ -437,6 +427,10 @@ static inline const YGValue * YGNodeStyleGetFlexBasisPtr(const YGNodeRef node) {
return &YGValueUndefined; return &YGValueUndefined;
} }
inline YGValue YGNodeStyleGetFlexBasis(const YGNodeRef node) {
return *YGNodeStyleGetFlexBasisPtr(node);
}
void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) { void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
if (node->style.flex != flex) { if (node->style.flex != flex) {
node->style.flex = flex; node->style.flex = flex;