From cda328fa7e5392213121edaaebb97b95f60d10f6 Mon Sep 17 00:00:00 2001 From: Jonathan Dann Date: Wed, 21 Mar 2018 16:05:09 -0700 Subject: [PATCH] Pass-by-reference in YGNode::setStyle() ::setChildren() ::setLayout() Summary: These shouldn't be copying the arguments when they pass by value. Instead these only get copied when assigning the value to the member. Reviewed By: priteshrnandgaonkar Differential Revision: D7291096 fbshipit-source-id: 7a4025831811d622050adbb5f86608855b94d68e --- yoga/YGNode.cpp | 6 +++--- yoga/YGNode.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/yoga/YGNode.cpp b/yoga/YGNode.cpp index 5a33c6e8..7a71058a 100644 --- a/yoga/YGNode.cpp +++ b/yoga/YGNode.cpp @@ -225,11 +225,11 @@ void YGNode::setDirtiedFunc(YGDirtiedFunc dirtiedFunc) { dirtied_ = dirtiedFunc; } -void YGNode::setStyle(YGStyle style) { +void YGNode::setStyle(const YGStyle& style) { style_ = style; } -void YGNode::setLayout(YGLayout layout) { +void YGNode::setLayout(const YGLayout& layout) { layout_ = layout; } @@ -241,7 +241,7 @@ void YGNode::setParent(YGNodeRef parent) { parent_ = parent; } -void YGNode::setChildren(YGVector children) { +void YGNode::setChildren(const YGVector& children) { children_ = children; } diff --git a/yoga/YGNode.h b/yoga/YGNode.h index 27a1ed68..081bc235 100644 --- a/yoga/YGNode.h +++ b/yoga/YGNode.h @@ -106,13 +106,13 @@ struct YGNode { void setMeasureFunc(YGMeasureFunc measureFunc); void setBaseLineFunc(YGBaselineFunc baseLineFunc); void setDirtiedFunc(YGDirtiedFunc dirtiedFunc); - void setStyle(YGStyle style); + void setStyle(const YGStyle& style); void setStyleFlexDirection(YGFlexDirection direction); void setStyleAlignContent(YGAlign alignContent); - void setLayout(YGLayout layout); + void setLayout(const YGLayout& layout); void setLineIndex(uint32_t lineIndex); void setParent(YGNodeRef parent); - void setChildren(YGVector children); + void setChildren(const YGVector& children); void setNextChild(YGNodeRef nextChild); void setConfig(YGConfigRef config); void setDirty(bool isDirty);