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:
David Aurelio
2019-01-08 12:47:53 -08:00
committed by Facebook Github Bot
parent 5ee32fbefc
commit ab9d06abf5
16 changed files with 188 additions and 176 deletions

View File

@@ -25,8 +25,7 @@
#define YGBENCHMARK(NAME, BLOCK) \
__start = clock(); \
for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \
{ BLOCK } \
__endTimes[__i] = clock(); \
{BLOCK} __endTimes[__i] = clock(); \
} \
__printBenchmarkResult(NAME, __start, __endTimes);
@@ -45,7 +44,10 @@ static int __compareDoubles(const void *a, const void *b) {
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 mean = 0;
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);
}
static YGSize _measure(YGNodeRef node,
static YGSize _measure(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
@@ -82,7 +84,6 @@ static YGSize _measure(YGNodeRef node,
}
YGBENCHMARKS({
YGBENCHMARK("Stack with flex", {
const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
@@ -160,7 +161,8 @@ YGBENCHMARKS({
for (uint32_t iiii = 0; iiii < 10; iiii++) {
const YGNodeRef grandGrandGrandChild = YGNodeNew();
YGNodeStyleSetFlexDirection(grandGrandGrandChild, YGFlexDirectionRow);
YGNodeStyleSetFlexDirection(
grandGrandGrandChild, YGFlexDirectionRow);
YGNodeStyleSetFlexGrow(grandGrandGrandChild, 1);
YGNodeStyleSetWidth(grandGrandGrandChild, 10);
YGNodeStyleSetHeight(grandGrandGrandChild, 10);
@@ -173,5 +175,4 @@ YGBENCHMARKS({
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
YGNodeFreeRecursive(root);
});
});

View File

@@ -180,8 +180,10 @@ static inline YGConfigRef _jlong2YGConfigRef(jlong addr) {
return reinterpret_cast<YGConfigRef>(static_cast<intptr_t>(addr));
}
static YGNodeRef
YGJNIOnNodeClonedFunc(YGNodeRef oldNode, YGNodeRef owner, int childIndex) {
static YGNodeRef YGJNIOnNodeClonedFunc(
YGNodeRef oldNode,
YGNodeRef owner,
int childIndex) {
auto config = oldNode->getConfig();
if (!config) {
return nullptr;

View File

@@ -63,7 +63,8 @@ WIN_EXPORT const char *YGEdgeToString(const YGEdge value);
typedef YG_ENUM_BEGIN(YGExperimentalFeature){
YGExperimentalFeatureWebFlexBasis,
} YG_ENUM_END(YGExperimentalFeature);
WIN_EXPORT const char *YGExperimentalFeatureToString(const YGExperimentalFeature value);
WIN_EXPORT const char* YGExperimentalFeatureToString(
const YGExperimentalFeature value);
#define YGFlexDirectionCount 4
typedef YG_ENUM_BEGIN(YGFlexDirection){

View File

@@ -29,9 +29,9 @@
#endif
#ifdef NS_ENUM
// Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a
// enum).
// Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI.
// Cannot use NSInteger as NSInteger has a different size than int (which is the
// default type of a enum). Therefor when linking the Yoga C library into obj-c
// the header is a missmatch for the Yoga ABI.
#define YG_ENUM_BEGIN(name) NS_ENUM(int, name)
#define YG_ENUM_END(name)
#else

View File

@@ -113,7 +113,8 @@ void YGNode::setMeasureFunc(YGMeasureFunc measureFunc) {
YGAssertWithNode(
this,
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;
// TODO: t18095186 Move nodeType to opt-in function and mark appropriate
// places in Litho

View File

@@ -63,15 +63,19 @@ static void appendNumberIfNotUndefined(
}
}
static void
appendNumberIfNotAuto(string& base, const string& key, const YGValue number) {
static void appendNumberIfNotAuto(
string& base,
const string& key,
const YGValue number) {
if (number.unit != YGUnitAuto) {
appendNumberIfNotUndefined(base, key, number);
}
}
static void
appendNumberIfNotZero(string& base, const string& str, const YGValue number) {
static void appendNumberIfNotZero(
string& base,
const string& str,
const YGValue number) {
if (number.unit == YGUnitAuto) {
base.append(str + ": auto; ");
} else if (!YGFloatsEqual(number.value, 0)) {

View File

@@ -358,8 +358,11 @@ WIN_EXPORT float YGNodeLayoutGetPadding(
const YGEdge edge);
WIN_EXPORT void YGConfigSetLogger(const YGConfigRef config, YGLogger logger);
WIN_EXPORT void
YGLog(const YGNodeRef node, YGLogLevel level, const char* message, ...);
WIN_EXPORT void YGLog(
const YGNodeRef node,
YGLogLevel level,
const char* message,
...);
WIN_EXPORT void YGLogWithConfig(
const YGConfigRef config,
YGLogLevel level,