Remove use of snake_case

Reviewed By: lucasr

Differential Revision: D3886849

fbshipit-source-id: eaf3f219fe1ccb717ba363dba0d2f475ffb204e3
This commit is contained in:
Emil Sjolander 2016-09-20 10:16:13 -07:00 committed by Facebook Github Bot 5
parent 922cd6ddfc
commit 7f2bbf4263
1 changed files with 102 additions and 101 deletions

View File

@ -54,7 +54,7 @@ typedef struct CSSLayout {
CSSCachedMeasurement cachedMeasurements[CSS_MAX_CACHED_RESULT_COUNT]; CSSCachedMeasurement cachedMeasurements[CSS_MAX_CACHED_RESULT_COUNT];
float measuredDimensions[2]; float measuredDimensions[2];
CSSCachedMeasurement cached_layout; CSSCachedMeasurement cachedLayout;
} CSSLayout; } CSSLayout;
typedef struct CSSStyle { typedef struct CSSStyle {
@ -186,8 +186,8 @@ void CSSNodeInit(const CSSNodeRef node) {
node->layout.measuredDimensions[CSSDimensionWidth] = CSSUndefined; node->layout.measuredDimensions[CSSDimensionWidth] = CSSUndefined;
node->layout.measuredDimensions[CSSDimensionHeight] = CSSUndefined; node->layout.measuredDimensions[CSSDimensionHeight] = CSSUndefined;
node->layout.cached_layout.widthMeasureMode = (CSSMeasureMode) -1; node->layout.cachedLayout.widthMeasureMode = (CSSMeasureMode) -1;
node->layout.cached_layout.heightMeasureMode = (CSSMeasureMode) -1; node->layout.cachedLayout.heightMeasureMode = (CSSMeasureMode) -1;
} }
void _CSSNodeMarkDirty(const CSSNodeRef node) { void _CSSNodeMarkDirty(const CSSNodeRef node) {
@ -362,24 +362,24 @@ static void indent(const uint32_t n) {
} }
} }
static void print_number_0(const char *str, const float number) { static void printNumberIfNotZero(const char *str, const float number) {
if (!eq(number, 0)) { if (!eq(number, 0)) {
printf("%s: %g, ", str, number); printf("%s: %g, ", str, number);
} }
} }
static void print_number_nan(const char *str, const float number) { static void printNumberIfNotUndefined(const char *str, const float number) {
if (!isnan(number)) { if (!CSSValueIsUndefined(number)) {
printf("%s: %g, ", str, number); printf("%s: %g, ", str, number);
} }
} }
static bool four_equal(const float four[4]) { static bool eqFour(const float four[4]) {
return eq(four[0], four[1]) && eq(four[0], four[2]) && eq(four[0], four[3]); return eq(four[0], four[1]) && eq(four[0], four[2]) && eq(four[0], four[3]);
} }
static void static void
print_css_node_rec(const CSSNodeRef node, const CSSPrintOptions options, const uint32_t level) { _CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options, const uint32_t level) {
indent(level); indent(level);
printf("{"); printf("{");
@ -443,9 +443,9 @@ print_css_node_rec(const CSSNodeRef node, const CSSPrintOptions options, const u
printf("alignSelf: 'stretch', "); printf("alignSelf: 'stretch', ");
} }
print_number_nan("flexGrow", node->style.flexGrow); printNumberIfNotUndefined("flexGrow", node->style.flexGrow);
print_number_nan("flexShrink", node->style.flexShrink); printNumberIfNotUndefined("flexShrink", node->style.flexShrink);
print_number_nan("flexBasis", node->style.flexBasis); printNumberIfNotUndefined("flexBasis", node->style.flexBasis);
if (node->style.overflow == CSSOverflowHidden) { if (node->style.overflow == CSSOverflowHidden) {
printf("overflow: 'hidden', "); printf("overflow: 'hidden', ");
@ -453,62 +453,70 @@ print_css_node_rec(const CSSNodeRef node, const CSSPrintOptions options, const u
printf("overflow: 'visible', "); printf("overflow: 'visible', ");
} }
if (four_equal(node->style.margin)) { if (eqFour(node->style.margin)) {
print_number_0("margin", computedEdgeValue(node->style.margin, CSSEdgeLeft, 0)); printNumberIfNotZero("margin", computedEdgeValue(node->style.margin, CSSEdgeLeft, 0));
} else { } else {
print_number_0("marginLeft", computedEdgeValue(node->style.margin, CSSEdgeLeft, 0)); printNumberIfNotZero("marginLeft", computedEdgeValue(node->style.margin, CSSEdgeLeft, 0));
print_number_0("marginRight", computedEdgeValue(node->style.margin, CSSEdgeRight, 0)); printNumberIfNotZero("marginRight", computedEdgeValue(node->style.margin, CSSEdgeRight, 0));
print_number_0("marginTop", computedEdgeValue(node->style.margin, CSSEdgeTop, 0)); printNumberIfNotZero("marginTop", computedEdgeValue(node->style.margin, CSSEdgeTop, 0));
print_number_0("marginBottom", computedEdgeValue(node->style.margin, CSSEdgeBottom, 0)); printNumberIfNotZero("marginBottom", computedEdgeValue(node->style.margin, CSSEdgeBottom, 0));
print_number_0("marginStart", computedEdgeValue(node->style.margin, CSSEdgeStart, 0)); printNumberIfNotZero("marginStart", computedEdgeValue(node->style.margin, CSSEdgeStart, 0));
print_number_0("marginEnd", computedEdgeValue(node->style.margin, CSSEdgeEnd, 0)); printNumberIfNotZero("marginEnd", computedEdgeValue(node->style.margin, CSSEdgeEnd, 0));
} }
if (four_equal(node->style.padding)) { if (eqFour(node->style.padding)) {
print_number_0("padding", computedEdgeValue(node->style.padding, CSSEdgeLeft, 0)); printNumberIfNotZero("padding", computedEdgeValue(node->style.padding, CSSEdgeLeft, 0));
} else { } else {
print_number_0("paddingLeft", computedEdgeValue(node->style.padding, CSSEdgeLeft, 0)); printNumberIfNotZero("paddingLeft", computedEdgeValue(node->style.padding, CSSEdgeLeft, 0));
print_number_0("paddingRight", computedEdgeValue(node->style.padding, CSSEdgeRight, 0)); printNumberIfNotZero("paddingRight", computedEdgeValue(node->style.padding, CSSEdgeRight, 0));
print_number_0("paddingTop", computedEdgeValue(node->style.padding, CSSEdgeTop, 0)); printNumberIfNotZero("paddingTop", computedEdgeValue(node->style.padding, CSSEdgeTop, 0));
print_number_0("paddingBottom", computedEdgeValue(node->style.padding, CSSEdgeBottom, 0)); printNumberIfNotZero("paddingBottom",
print_number_0("paddingStart", computedEdgeValue(node->style.padding, CSSEdgeStart, 0)); computedEdgeValue(node->style.padding, CSSEdgeBottom, 0));
print_number_0("paddingEnd", computedEdgeValue(node->style.padding, CSSEdgeEnd, 0)); printNumberIfNotZero("paddingStart", computedEdgeValue(node->style.padding, CSSEdgeStart, 0));
printNumberIfNotZero("paddingEnd", computedEdgeValue(node->style.padding, CSSEdgeEnd, 0));
} }
if (four_equal(node->style.border)) { if (eqFour(node->style.border)) {
print_number_0("borderWidth", computedEdgeValue(node->style.border, CSSEdgeLeft, 0)); printNumberIfNotZero("borderWidth", computedEdgeValue(node->style.border, CSSEdgeLeft, 0));
} else { } else {
print_number_0("borderLeftWidth", computedEdgeValue(node->style.border, CSSEdgeLeft, 0)); printNumberIfNotZero("borderLeftWidth",
print_number_0("borderRightWidth", computedEdgeValue(node->style.border, CSSEdgeRight, 0)); computedEdgeValue(node->style.border, CSSEdgeLeft, 0));
print_number_0("borderTopWidth", computedEdgeValue(node->style.border, CSSEdgeTop, 0)); printNumberIfNotZero("borderRightWidth",
print_number_0("borderBottomWidth", computedEdgeValue(node->style.border, CSSEdgeBottom, 0)); computedEdgeValue(node->style.border, CSSEdgeRight, 0));
print_number_0("borderStartWidth", computedEdgeValue(node->style.border, CSSEdgeStart, 0)); printNumberIfNotZero("borderTopWidth", computedEdgeValue(node->style.border, CSSEdgeTop, 0));
print_number_0("borderEndWidth", computedEdgeValue(node->style.border, CSSEdgeEnd, 0)); printNumberIfNotZero("borderBottomWidth",
computedEdgeValue(node->style.border, CSSEdgeBottom, 0));
printNumberIfNotZero("borderStartWidth",
computedEdgeValue(node->style.border, CSSEdgeStart, 0));
printNumberIfNotZero("borderEndWidth", computedEdgeValue(node->style.border, CSSEdgeEnd, 0));
} }
print_number_nan("width", node->style.dimensions[CSSDimensionWidth]); printNumberIfNotUndefined("width", node->style.dimensions[CSSDimensionWidth]);
print_number_nan("height", node->style.dimensions[CSSDimensionHeight]); printNumberIfNotUndefined("height", node->style.dimensions[CSSDimensionHeight]);
print_number_nan("maxWidth", node->style.maxDimensions[CSSDimensionWidth]); printNumberIfNotUndefined("maxWidth", node->style.maxDimensions[CSSDimensionWidth]);
print_number_nan("maxHeight", node->style.maxDimensions[CSSDimensionHeight]); printNumberIfNotUndefined("maxHeight", node->style.maxDimensions[CSSDimensionHeight]);
print_number_nan("minWidth", node->style.minDimensions[CSSDimensionWidth]); printNumberIfNotUndefined("minWidth", node->style.minDimensions[CSSDimensionWidth]);
print_number_nan("minHeight", node->style.minDimensions[CSSDimensionHeight]); printNumberIfNotUndefined("minHeight", node->style.minDimensions[CSSDimensionHeight]);
if (node->style.positionType == CSSPositionTypeAbsolute) { if (node->style.positionType == CSSPositionTypeAbsolute) {
printf("position: 'absolute', "); printf("position: 'absolute', ");
} }
print_number_nan("left", computedEdgeValue(node->style.position, CSSEdgeLeft, CSSUndefined)); printNumberIfNotUndefined("left",
print_number_nan("right", computedEdgeValue(node->style.position, CSSEdgeRight, CSSUndefined)); computedEdgeValue(node->style.position, CSSEdgeLeft, CSSUndefined));
print_number_nan("top", computedEdgeValue(node->style.position, CSSEdgeTop, CSSUndefined)); printNumberIfNotUndefined("right",
print_number_nan("bottom", computedEdgeValue(node->style.position, CSSEdgeRight, CSSUndefined));
computedEdgeValue(node->style.position, CSSEdgeBottom, CSSUndefined)); printNumberIfNotUndefined("top",
computedEdgeValue(node->style.position, CSSEdgeTop, CSSUndefined));
printNumberIfNotUndefined("bottom",
computedEdgeValue(node->style.position, CSSEdgeBottom, CSSUndefined));
} }
const uint32_t childCount = CSSNodeListCount(node->children); const uint32_t childCount = CSSNodeListCount(node->children);
if (options & CSSPrintOptionsChildren && childCount > 0) { if (options & CSSPrintOptionsChildren && childCount > 0) {
printf("children: [\n"); printf("children: [\n");
for (uint32_t i = 0; i < childCount; i++) { for (uint32_t i = 0; i < childCount; i++) {
print_css_node_rec(CSSNodeGetChild(node, i), options, level + 1); _CSSNodePrint(CSSNodeGetChild(node, i), options, level + 1);
} }
indent(level); indent(level);
printf("]},\n"); printf("]},\n");
@ -518,7 +526,7 @@ print_css_node_rec(const CSSNodeRef node, const CSSPrintOptions options, const u
} }
void CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options) { void CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options) {
print_css_node_rec(node, options, 0); _CSSNodePrint(node, options, 0);
} }
static const CSSEdge leading[4] = { static const CSSEdge leading[4] = {
@ -555,8 +563,7 @@ static bool isColumnDirection(const CSSFlexDirection flexDirection) {
} }
static float getLeadingMargin(const CSSNodeRef node, const CSSFlexDirection axis) { static float getLeadingMargin(const CSSNodeRef node, const CSSFlexDirection axis) {
if (isRowDirection(axis) && if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.margin[CSSEdgeStart])) {
!CSSValueIsUndefined(node->style.margin[CSSEdgeStart])) {
return node->style.margin[CSSEdgeStart]; return node->style.margin[CSSEdgeStart];
} }
@ -564,8 +571,7 @@ static float getLeadingMargin(const CSSNodeRef node, const CSSFlexDirection axis
} }
static float getTrailingMargin(const CSSNodeRef node, const CSSFlexDirection axis) { static float getTrailingMargin(const CSSNodeRef node, const CSSFlexDirection axis) {
if (isRowDirection(axis) && if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.margin[CSSEdgeEnd])) {
!CSSValueIsUndefined(node->style.margin[CSSEdgeEnd])) {
return node->style.margin[CSSEdgeEnd]; return node->style.margin[CSSEdgeEnd];
} }
@ -573,8 +579,7 @@ static float getTrailingMargin(const CSSNodeRef node, const CSSFlexDirection axi
} }
static float getLeadingPadding(const CSSNodeRef node, const CSSFlexDirection axis) { static float getLeadingPadding(const CSSNodeRef node, const CSSFlexDirection axis) {
if (isRowDirection(axis) && if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.padding[CSSEdgeStart]) &&
!CSSValueIsUndefined(node->style.padding[CSSEdgeStart]) &&
node->style.padding[CSSEdgeStart] >= 0) { node->style.padding[CSSEdgeStart] >= 0) {
return node->style.padding[CSSEdgeStart]; return node->style.padding[CSSEdgeStart];
} }
@ -587,8 +592,7 @@ static float getLeadingPadding(const CSSNodeRef node, const CSSFlexDirection axi
} }
static float getTrailingPadding(const CSSNodeRef node, const CSSFlexDirection axis) { static float getTrailingPadding(const CSSNodeRef node, const CSSFlexDirection axis) {
if (isRowDirection(axis) && if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.padding[CSSEdgeEnd]) &&
!CSSValueIsUndefined(node->style.padding[CSSEdgeEnd]) &&
node->style.padding[CSSEdgeEnd] >= 0) { node->style.padding[CSSEdgeEnd] >= 0) {
return node->style.padding[CSSEdgeEnd]; return node->style.padding[CSSEdgeEnd];
} }
@ -601,8 +605,7 @@ static float getTrailingPadding(const CSSNodeRef node, const CSSFlexDirection ax
} }
static float getLeadingBorder(const CSSNodeRef node, const CSSFlexDirection axis) { static float getLeadingBorder(const CSSNodeRef node, const CSSFlexDirection axis) {
if (isRowDirection(axis) && if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.border[CSSEdgeStart]) &&
!CSSValueIsUndefined(node->style.border[CSSEdgeStart]) &&
node->style.border[CSSEdgeStart] >= 0) { node->style.border[CSSEdgeStart] >= 0) {
return node->style.border[CSSEdgeStart]; return node->style.border[CSSEdgeStart];
} }
@ -615,8 +618,7 @@ static float getLeadingBorder(const CSSNodeRef node, const CSSFlexDirection axis
} }
static float getTrailingBorder(const CSSNodeRef node, const CSSFlexDirection axis) { static float getTrailingBorder(const CSSNodeRef node, const CSSFlexDirection axis) {
if (isRowDirection(axis) && if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.border[CSSEdgeEnd]) &&
!CSSValueIsUndefined(node->style.border[CSSEdgeEnd]) &&
node->style.border[CSSEdgeEnd] >= 0) { node->style.border[CSSEdgeEnd] >= 0) {
return node->style.border[CSSEdgeEnd]; return node->style.border[CSSEdgeEnd];
} }
@ -1941,60 +1943,59 @@ static const char *getModeName(const CSSMeasureMode mode, const bool performLayo
static bool canUseCachedMeasurement(const bool isTextNode, static bool canUseCachedMeasurement(const bool isTextNode,
const float availableWidth, const float availableWidth,
const float availableHeight, const float availableHeight,
const float margin_row, const float marginRow,
const float margin_column, const float marginColumn,
const CSSMeasureMode widthMeasureMode, const CSSMeasureMode widthMeasureMode,
const CSSMeasureMode heightMeasureMode, const CSSMeasureMode heightMeasureMode,
CSSCachedMeasurement cached_layout) { CSSCachedMeasurement cachedLayout) {
const bool is_height_same = (cached_layout.heightMeasureMode == CSSMeasureModeUndefined && const bool isHeightSame = (cachedLayout.heightMeasureMode == CSSMeasureModeUndefined &&
heightMeasureMode == CSSMeasureModeUndefined) || heightMeasureMode == CSSMeasureModeUndefined) ||
(cached_layout.heightMeasureMode == heightMeasureMode && (cachedLayout.heightMeasureMode == heightMeasureMode &&
eq(cached_layout.availableHeight, availableHeight)); eq(cachedLayout.availableHeight, availableHeight));
const bool is_width_same = (cached_layout.widthMeasureMode == CSSMeasureModeUndefined && const bool isWidthSame = (cachedLayout.widthMeasureMode == CSSMeasureModeUndefined &&
widthMeasureMode == CSSMeasureModeUndefined) || widthMeasureMode == CSSMeasureModeUndefined) ||
(cached_layout.widthMeasureMode == widthMeasureMode && (cachedLayout.widthMeasureMode == widthMeasureMode &&
eq(cached_layout.availableWidth, availableWidth)); eq(cachedLayout.availableWidth, availableWidth));
if (is_height_same && is_width_same) { if (isHeightSame && isWidthSame) {
return true; return true;
} }
const bool is_height_valid = const bool isHeightValid = (cachedLayout.heightMeasureMode == CSSMeasureModeUndefined &&
(cached_layout.heightMeasureMode == CSSMeasureModeUndefined && heightMeasureMode == CSSMeasureModeAtMost &&
heightMeasureMode == CSSMeasureModeAtMost && cachedLayout.computedHeight <= (availableHeight - marginColumn)) ||
cached_layout.computedHeight <= (availableHeight - margin_column)) || (heightMeasureMode == CSSMeasureModeExactly &&
(heightMeasureMode == CSSMeasureModeExactly && eq(cachedLayout.computedHeight, availableHeight - marginColumn));
eq(cached_layout.computedHeight, availableHeight - margin_column));
if (is_width_same && is_height_valid) { if (isWidthSame && isHeightValid) {
return true; return true;
} }
const bool is_width_valid = (cached_layout.widthMeasureMode == CSSMeasureModeUndefined && const bool isWidthValid = (cachedLayout.widthMeasureMode == CSSMeasureModeUndefined &&
widthMeasureMode == CSSMeasureModeAtMost && widthMeasureMode == CSSMeasureModeAtMost &&
cached_layout.computedWidth <= (availableWidth - margin_row)) || cachedLayout.computedWidth <= (availableWidth - marginRow)) ||
(widthMeasureMode == CSSMeasureModeExactly && (widthMeasureMode == CSSMeasureModeExactly &&
eq(cached_layout.computedWidth, availableWidth - margin_row)); eq(cachedLayout.computedWidth, availableWidth - marginRow));
if (is_height_same && is_width_valid) { if (isHeightSame && isWidthValid) {
return true; return true;
} }
if (is_height_valid && is_width_valid) { if (isHeightValid && isWidthValid) {
return true; return true;
} }
// We know this to be text so we can apply some more specialized heuristics. // We know this to be text so we can apply some more specialized heuristics.
if (isTextNode) { if (isTextNode) {
if (is_width_same) { if (isWidthSame) {
if (heightMeasureMode == CSSMeasureModeUndefined) { if (heightMeasureMode == CSSMeasureModeUndefined) {
// Width is the same and height is not restricted. Re-use cahced value. // Width is the same and height is not restricted. Re-use cahced value.
return true; return true;
} }
if (heightMeasureMode == CSSMeasureModeAtMost && if (heightMeasureMode == CSSMeasureModeAtMost &&
cached_layout.computedHeight < (availableHeight - margin_column)) { cachedLayout.computedHeight < (availableHeight - marginColumn)) {
// Width is the same and height restriction is greater than the cached // Width is the same and height restriction is greater than the cached
// height. Re-use cached // height. Re-use cached
// value. // value.
@ -2004,14 +2005,14 @@ static bool canUseCachedMeasurement(const bool isTextNode,
// Width is the same but height restriction imposes smaller height than // Width is the same but height restriction imposes smaller height than
// previously measured. // previously measured.
// Update the cached value to respect the new height restriction. // Update the cached value to respect the new height restriction.
cached_layout.computedHeight = availableHeight - margin_column; cachedLayout.computedHeight = availableHeight - marginColumn;
return true; return true;
} }
if (cached_layout.widthMeasureMode == CSSMeasureModeUndefined) { if (cachedLayout.widthMeasureMode == CSSMeasureModeUndefined) {
if (widthMeasureMode == CSSMeasureModeUndefined || if (widthMeasureMode == CSSMeasureModeUndefined ||
(widthMeasureMode == CSSMeasureModeAtMost && (widthMeasureMode == CSSMeasureModeAtMost &&
cached_layout.computedWidth <= (availableWidth - margin_row))) { cachedLayout.computedWidth <= (availableWidth - marginRow))) {
// Previsouly this text was measured with no width restriction, if width // Previsouly this text was measured with no width restriction, if width
// is now restricted // is now restricted
// but to a larger value than the previsouly measured width we can // but to a larger value than the previsouly measured width we can
@ -2052,8 +2053,8 @@ bool layoutNodeInternal(const CSSNodeRef node,
if (needToVisitNode) { if (needToVisitNode) {
// Invalidate the cached results. // Invalidate the cached results.
layout->nextCachedMeasurementsIndex = 0; layout->nextCachedMeasurementsIndex = 0;
layout->cached_layout.widthMeasureMode = (CSSMeasureMode) -1; layout->cachedLayout.widthMeasureMode = (CSSMeasureMode) -1;
layout->cached_layout.heightMeasureMode = (CSSMeasureMode) -1; layout->cachedLayout.heightMeasureMode = (CSSMeasureMode) -1;
} }
CSSCachedMeasurement *cachedResults = NULL; CSSCachedMeasurement *cachedResults = NULL;
@ -2082,8 +2083,8 @@ bool layoutNodeInternal(const CSSNodeRef node,
marginAxisColumn, marginAxisColumn,
widthMeasureMode, widthMeasureMode,
heightMeasureMode, heightMeasureMode,
layout->cached_layout)) { layout->cachedLayout)) {
cachedResults = &layout->cached_layout; cachedResults = &layout->cachedLayout;
} else { } else {
// Try to use the measurement cache. // Try to use the measurement cache.
for (uint32_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) { for (uint32_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) {
@ -2101,11 +2102,11 @@ bool layoutNodeInternal(const CSSNodeRef node,
} }
} }
} else if (performLayout) { } else if (performLayout) {
if (eq(layout->cached_layout.availableWidth, availableWidth) && if (eq(layout->cachedLayout.availableWidth, availableWidth) &&
eq(layout->cached_layout.availableHeight, availableHeight) && eq(layout->cachedLayout.availableHeight, availableHeight) &&
layout->cached_layout.widthMeasureMode == widthMeasureMode && layout->cachedLayout.widthMeasureMode == widthMeasureMode &&
layout->cached_layout.heightMeasureMode == heightMeasureMode) { layout->cachedLayout.heightMeasureMode == heightMeasureMode) {
cachedResults = &layout->cached_layout; cachedResults = &layout->cachedLayout;
} }
} else { } else {
for (uint32_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) { for (uint32_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) {
@ -2185,7 +2186,7 @@ bool layoutNodeInternal(const CSSNodeRef node,
CSSCachedMeasurement *newCacheEntry; CSSCachedMeasurement *newCacheEntry;
if (performLayout) { if (performLayout) {
// Use the single layout cache entry. // Use the single layout cache entry.
newCacheEntry = &layout->cached_layout; newCacheEntry = &layout->cachedLayout;
} else { } else {
// Allocate a new measurement cache entry. // Allocate a new measurement cache entry.
newCacheEntry = &layout->cachedMeasurements[layout->nextCachedMeasurementsIndex]; newCacheEntry = &layout->cachedMeasurements[layout->nextCachedMeasurementsIndex];