Apply clang-format rules
Summary: @public Formats Yoga's source according to our clang-format configuration Reviewed By: SidharthGuglani Differential Revision: D13596650 fbshipit-source-id: c3722d4eafd63b7596a8b1e85c0197e9d2d6cb7d
This commit is contained in:
committed by
Facebook Github Bot
parent
5ee32fbefc
commit
ab9d06abf5
@@ -25,8 +25,7 @@
|
|||||||
#define YGBENCHMARK(NAME, BLOCK) \
|
#define YGBENCHMARK(NAME, BLOCK) \
|
||||||
__start = clock(); \
|
__start = clock(); \
|
||||||
for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \
|
for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \
|
||||||
{ BLOCK } \
|
{BLOCK} __endTimes[__i] = clock(); \
|
||||||
__endTimes[__i] = clock(); \
|
|
||||||
} \
|
} \
|
||||||
__printBenchmarkResult(NAME, __start, __endTimes);
|
__printBenchmarkResult(NAME, __start, __endTimes);
|
||||||
|
|
||||||
@@ -45,7 +44,10 @@ static int __compareDoubles(const void *a, const void *b) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __printBenchmarkResult(char *name, clock_t start, clock_t *endTimes) {
|
static void __printBenchmarkResult(
|
||||||
|
char* name,
|
||||||
|
clock_t start,
|
||||||
|
clock_t* endTimes) {
|
||||||
double timesInMs[NUM_REPETITIONS];
|
double timesInMs[NUM_REPETITIONS];
|
||||||
double mean = 0;
|
double mean = 0;
|
||||||
clock_t lastEnd = start;
|
clock_t lastEnd = start;
|
||||||
@@ -69,8 +71,8 @@ static void __printBenchmarkResult(char *name, clock_t start, clock_t *endTimes)
|
|||||||
printf("%s: median: %lf ms, stddev: %lf ms\n", name, median, stddev);
|
printf("%s: median: %lf ms, stddev: %lf ms\n", name, median, stddev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static YGSize _measure(
|
||||||
static YGSize _measure(YGNodeRef node,
|
YGNodeRef node,
|
||||||
float width,
|
float width,
|
||||||
YGMeasureMode widthMode,
|
YGMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
@@ -82,7 +84,6 @@ static YGSize _measure(YGNodeRef node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
YGBENCHMARKS({
|
YGBENCHMARKS({
|
||||||
|
|
||||||
YGBENCHMARK("Stack with flex", {
|
YGBENCHMARK("Stack with flex", {
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
YGNodeStyleSetWidth(root, 100);
|
YGNodeStyleSetWidth(root, 100);
|
||||||
@@ -160,7 +161,8 @@ YGBENCHMARKS({
|
|||||||
|
|
||||||
for (uint32_t iiii = 0; iiii < 10; iiii++) {
|
for (uint32_t iiii = 0; iiii < 10; iiii++) {
|
||||||
const YGNodeRef grandGrandGrandChild = YGNodeNew();
|
const YGNodeRef grandGrandGrandChild = YGNodeNew();
|
||||||
YGNodeStyleSetFlexDirection(grandGrandGrandChild, YGFlexDirectionRow);
|
YGNodeStyleSetFlexDirection(
|
||||||
|
grandGrandGrandChild, YGFlexDirectionRow);
|
||||||
YGNodeStyleSetFlexGrow(grandGrandGrandChild, 1);
|
YGNodeStyleSetFlexGrow(grandGrandGrandChild, 1);
|
||||||
YGNodeStyleSetWidth(grandGrandGrandChild, 10);
|
YGNodeStyleSetWidth(grandGrandGrandChild, 10);
|
||||||
YGNodeStyleSetHeight(grandGrandGrandChild, 10);
|
YGNodeStyleSetHeight(grandGrandGrandChild, 10);
|
||||||
@@ -173,5 +175,4 @@ YGBENCHMARKS({
|
|||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -180,8 +180,10 @@ static inline YGConfigRef _jlong2YGConfigRef(jlong addr) {
|
|||||||
return reinterpret_cast<YGConfigRef>(static_cast<intptr_t>(addr));
|
return reinterpret_cast<YGConfigRef>(static_cast<intptr_t>(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static YGNodeRef
|
static YGNodeRef YGJNIOnNodeClonedFunc(
|
||||||
YGJNIOnNodeClonedFunc(YGNodeRef oldNode, YGNodeRef owner, int childIndex) {
|
YGNodeRef oldNode,
|
||||||
|
YGNodeRef owner,
|
||||||
|
int childIndex) {
|
||||||
auto config = oldNode->getConfig();
|
auto config = oldNode->getConfig();
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@@ -63,7 +63,8 @@ WIN_EXPORT const char *YGEdgeToString(const YGEdge value);
|
|||||||
typedef YG_ENUM_BEGIN(YGExperimentalFeature){
|
typedef YG_ENUM_BEGIN(YGExperimentalFeature){
|
||||||
YGExperimentalFeatureWebFlexBasis,
|
YGExperimentalFeatureWebFlexBasis,
|
||||||
} YG_ENUM_END(YGExperimentalFeature);
|
} YG_ENUM_END(YGExperimentalFeature);
|
||||||
WIN_EXPORT const char *YGExperimentalFeatureToString(const YGExperimentalFeature value);
|
WIN_EXPORT const char* YGExperimentalFeatureToString(
|
||||||
|
const YGExperimentalFeature value);
|
||||||
|
|
||||||
#define YGFlexDirectionCount 4
|
#define YGFlexDirectionCount 4
|
||||||
typedef YG_ENUM_BEGIN(YGFlexDirection){
|
typedef YG_ENUM_BEGIN(YGFlexDirection){
|
||||||
|
@@ -29,9 +29,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NS_ENUM
|
#ifdef NS_ENUM
|
||||||
// Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a
|
// Cannot use NSInteger as NSInteger has a different size than int (which is the
|
||||||
// enum).
|
// default type of a enum). Therefor when linking the Yoga C library into obj-c
|
||||||
// Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI.
|
// the header is a missmatch for the Yoga ABI.
|
||||||
#define YG_ENUM_BEGIN(name) NS_ENUM(int, name)
|
#define YG_ENUM_BEGIN(name) NS_ENUM(int, name)
|
||||||
#define YG_ENUM_END(name)
|
#define YG_ENUM_END(name)
|
||||||
#else
|
#else
|
||||||
|
@@ -113,7 +113,8 @@ void YGNode::setMeasureFunc(YGMeasureFunc measureFunc) {
|
|||||||
YGAssertWithNode(
|
YGAssertWithNode(
|
||||||
this,
|
this,
|
||||||
children_.size() == 0,
|
children_.size() == 0,
|
||||||
"Cannot set measure function: Nodes with measure functions cannot have children.");
|
"Cannot set measure function: Nodes with measure functions cannot have "
|
||||||
|
"children.");
|
||||||
measure_ = measureFunc;
|
measure_ = measureFunc;
|
||||||
// TODO: t18095186 Move nodeType to opt-in function and mark appropriate
|
// TODO: t18095186 Move nodeType to opt-in function and mark appropriate
|
||||||
// places in Litho
|
// places in Litho
|
||||||
|
@@ -63,15 +63,19 @@ static void appendNumberIfNotUndefined(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void appendNumberIfNotAuto(
|
||||||
appendNumberIfNotAuto(string& base, const string& key, const YGValue number) {
|
string& base,
|
||||||
|
const string& key,
|
||||||
|
const YGValue number) {
|
||||||
if (number.unit != YGUnitAuto) {
|
if (number.unit != YGUnitAuto) {
|
||||||
appendNumberIfNotUndefined(base, key, number);
|
appendNumberIfNotUndefined(base, key, number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void appendNumberIfNotZero(
|
||||||
appendNumberIfNotZero(string& base, const string& str, const YGValue number) {
|
string& base,
|
||||||
|
const string& str,
|
||||||
|
const YGValue number) {
|
||||||
if (number.unit == YGUnitAuto) {
|
if (number.unit == YGUnitAuto) {
|
||||||
base.append(str + ": auto; ");
|
base.append(str + ": auto; ");
|
||||||
} else if (!YGFloatsEqual(number.value, 0)) {
|
} else if (!YGFloatsEqual(number.value, 0)) {
|
||||||
|
@@ -358,8 +358,11 @@ WIN_EXPORT float YGNodeLayoutGetPadding(
|
|||||||
const YGEdge edge);
|
const YGEdge edge);
|
||||||
|
|
||||||
WIN_EXPORT void YGConfigSetLogger(const YGConfigRef config, YGLogger logger);
|
WIN_EXPORT void YGConfigSetLogger(const YGConfigRef config, YGLogger logger);
|
||||||
WIN_EXPORT void
|
WIN_EXPORT void YGLog(
|
||||||
YGLog(const YGNodeRef node, YGLogLevel level, const char* message, ...);
|
const YGNodeRef node,
|
||||||
|
YGLogLevel level,
|
||||||
|
const char* message,
|
||||||
|
...);
|
||||||
WIN_EXPORT void YGLogWithConfig(
|
WIN_EXPORT void YGLogWithConfig(
|
||||||
const YGConfigRef config,
|
const YGConfigRef config,
|
||||||
YGLogLevel level,
|
YGLogLevel level,
|
||||||
|
Reference in New Issue
Block a user