Update clang-format rules

Summary: Spent a couple hours customizing the clang-format rules to better match the desired code style.

Reviewed By: IanChilds

Differential Revision: D3714510

fbshipit-source-id: f6d0436346416aab023aacbedd70ea189e583e8d
This commit is contained in:
Emil Sjolander
2016-08-15 09:15:02 -07:00
committed by Facebook Github Bot 6
parent 6a44dbc43b
commit 7a1e353404
10 changed files with 602 additions and 460 deletions

View File

@@ -90,10 +90,10 @@ typedef struct CSSNode {
struct CSSNode *nextChild;
CSSSize (*measure)(void *context,
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode);
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode);
void (*print)(void *context);
void *context;
} CSSNode;

File diff suppressed because it is too large Load Diff

View File

@@ -11,9 +11,9 @@
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef __cplusplus
#include <stdbool.h>
@@ -21,8 +21,8 @@
// Not defined in MSVC++
#ifndef NAN
static const unsigned long __nan[2] = { 0xffffffff, 0x7fffffff };
#define NAN (*(const float *)__nan)
static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
#define NAN (*(const float *) __nan)
#endif
#define CSSUndefined NAN
@@ -113,8 +113,11 @@ typedef struct CSSSize {
} CSSSize;
typedef struct CSSNode *CSSNodeRef;
typedef CSSSize (*CSSMeasureFunc)(
void *context, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode);
typedef CSSSize (*CSSMeasureFunc)(void *context,
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode);
typedef void (*CSSPrintFunc)(void *context);
// CSSNode
@@ -127,8 +130,10 @@ void CSSNodeRemoveChild(CSSNodeRef node, CSSNodeRef child);
CSSNodeRef CSSNodeGetChild(CSSNodeRef node, uint32_t index);
uint32_t CSSNodeChildCount(CSSNodeRef node);
void CSSNodeCalculateLayout(
CSSNodeRef node, float availableWidth, float availableHeight, CSSDirection parentDirection);
void CSSNodeCalculateLayout(CSSNodeRef node,
float availableWidth,
float availableHeight,
CSSDirection parentDirection);
// Mark a node as dirty. Only valid for nodes with a custom measure function
// set.
@@ -143,12 +148,12 @@ void CSSNodePrint(CSSNodeRef node, CSSPrintOptions options);
bool CSSValueIsUndefined(float value);
#define CSS_NODE_PROPERTY(type, name, paramName) \
void CSSNodeSet##name(CSSNodeRef node, type paramName); \
#define CSS_NODE_PROPERTY(type, name, paramName) \
void CSSNodeSet##name(CSSNodeRef node, type paramName); \
type CSSNodeGet##name(CSSNodeRef node);
#define CSS_NODE_STYLE_PROPERTY(type, name, paramName) \
void CSSNodeStyleSet##name(CSSNodeRef node, type paramName); \
#define CSS_NODE_STYLE_PROPERTY(type, name, paramName) \
void CSSNodeStyleSet##name(CSSNodeRef node, type paramName); \
type CSSNodeStyleGet##name(CSSNodeRef node);
#define CSS_NODE_LAYOUT_PROPERTY(type, name) type CSSNodeLayoutGet##name(CSSNodeRef node);

View File

@@ -27,8 +27,8 @@
#define CSS_ABORT()
#endif
#define CSS_ASSERT(X, message) \
if (!(X)) { \
fprintf(stderr, "%s\n", message); \
CSS_ABORT(); \
#define CSS_ASSERT(X, message) \
if (!(X)) { \
fprintf(stderr, "%s\n", message); \
CSS_ABORT(); \
}

View File

@@ -28,11 +28,13 @@ CSSNodeListRef CSSNodeListNew(uint32_t initialCapacity) {
}
void CSSNodeListFree(CSSNodeListRef list) {
free(list->items);
free(list);
free(list->items);
free(list);
}
uint32_t CSSNodeListCount(CSSNodeListRef list) { return list->count; }
uint32_t CSSNodeListCount(CSSNodeListRef list) {
return list->count;
}
void CSSNodeListAdd(CSSNodeListRef list, CSSNodeRef node) {
CSSNodeListInsert(list, node, list->count);
@@ -76,4 +78,6 @@ CSSNodeRef CSSNodeListDelete(CSSNodeListRef list, CSSNodeRef node) {
return NULL;
}
CSSNodeRef CSSNodeListGet(CSSNodeListRef list, uint32_t index) { return list->items[index]; }
CSSNodeRef CSSNodeListGet(CSSNodeListRef list, uint32_t index) {
return list->items[index];
}

View File

@@ -10,9 +10,9 @@
#pragma once
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <CSSLayout/CSSLayout.h>
#include <CSSLayout/CSSMacros.h>