use struct initializer
This commit is contained in:
27
yoga/Yoga.c
27
yoga/Yoga.c
@@ -188,10 +188,11 @@ static inline YGValue YGComputedEdgeValue(const YGValue edges[YGEdgeCount],
|
|||||||
return YGValueUndefined;
|
return YGValueUndefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
YGValue result;
|
YGValue result = {
|
||||||
result.value = defaultValue;
|
.value = defaultValue,
|
||||||
result.defined = (defaultValue < 0 || defaultValue >= 0); /* is faster than a nan function call and enough at this point */
|
.defined = (defaultValue < 0 || defaultValue >= 0), /* is faster than a nan function call and enough at this point */
|
||||||
result.unit = YGUnitPixel;
|
.unit = YGUnitPixel,
|
||||||
|
};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,18 +261,20 @@ static void YGNodeInit(const YGNodeRef node) {
|
|||||||
int32_t gNodeInstanceCount = 0;
|
int32_t gNodeInstanceCount = 0;
|
||||||
|
|
||||||
YGValue YGPx(const float value){
|
YGValue YGPx(const float value){
|
||||||
YGValue result;
|
YGValue result = {
|
||||||
result.value = value;
|
.value = value,
|
||||||
result.defined = !YGFloatIsUndefined(value);
|
.defined = !YGFloatIsUndefined(value),
|
||||||
result.unit = YGUnitPixel;
|
.unit = YGUnitPixel,
|
||||||
|
};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
YGValue YGPercent(const float value){
|
YGValue YGPercent(const float value){
|
||||||
YGValue result;
|
YGValue result = {
|
||||||
result.value = value;
|
.value = value,
|
||||||
result.defined = !YGFloatIsUndefined(value);
|
.defined = !YGFloatIsUndefined(value),
|
||||||
result.unit = YGUnitPercent;
|
.unit = YGUnitPercent,
|
||||||
|
};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user