From 9ea8e73dd529c75f18ddd8f2339d01f5f3ca4f73 Mon Sep 17 00:00:00 2001 From: Lukas Woehrl Date: Mon, 19 Dec 2016 19:28:01 +0100 Subject: [PATCH] use struct initializer --- yoga/Yoga.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/yoga/Yoga.c b/yoga/Yoga.c index 1c263000..e387a5fd 100644 --- a/yoga/Yoga.c +++ b/yoga/Yoga.c @@ -188,11 +188,12 @@ static inline YGValue YGComputedEdgeValue(const YGValue edges[YGEdgeCount], return YGValueUndefined; } - YGValue result; - result.value = defaultValue; - result.defined = (defaultValue < 0 || defaultValue >= 0); /* is faster than a nan function call and enough at this point */ - result.unit = YGUnitPixel; - return result; + YGValue result = { + .value = defaultValue, + .defined = (defaultValue < 0 || defaultValue >= 0), /* is faster than a nan function call and enough at this point */ + .unit = YGUnitPixel, + }; + return result; } static inline float YGValueResolve(const YGValue unit, const float parentSize) { @@ -260,19 +261,21 @@ static void YGNodeInit(const YGNodeRef node) { int32_t gNodeInstanceCount = 0; YGValue YGPx(const float value){ - YGValue result; - result.value = value; - result.defined = !YGFloatIsUndefined(value); - result.unit = YGUnitPixel; - return result; + YGValue result = { + .value = value, + .defined = !YGFloatIsUndefined(value), + .unit = YGUnitPixel, + }; + return result; } YGValue YGPercent(const float value){ - YGValue result; - result.value = value; - result.defined = !YGFloatIsUndefined(value); - result.unit = YGUnitPercent; - return result; + YGValue result = { + .value = value, + .defined = !YGFloatIsUndefined(value), + .unit = YGUnitPercent, + }; + return result; } YGNodeRef YGNodeNew(void) {