Use const where possible

Summary: Use const where possible. This does not use const for all variables as that would require too much refactoring for one diff. It does however use const where currently possible as well as does some small refactoring to enable const usage in more locations. Striving for 100% const usage leads to code with is easier to reason about as a reference will always reference the same value. The compiler will also assist if you accidentally override a reference.

Reviewed By: IanChilds

Differential Revision: D3741999

fbshipit-source-id: 1ba7da5784c3047f2d4c03746890192f724aa65e
This commit is contained in:
Emil Sjolander
2016-08-22 06:58:13 -07:00
committed by Facebook Github Bot 6
parent 4bcefd8845
commit ca72b2b796
10 changed files with 328 additions and 332 deletions

View File

@@ -21,13 +21,13 @@ CSS_EXTERN_C_BEGIN
typedef struct CSSNodeList *CSSNodeListRef;
CSSNodeListRef CSSNodeListNew(uint32_t initialCapacity);
void CSSNodeListFree(CSSNodeListRef list);
uint32_t CSSNodeListCount(CSSNodeListRef list);
void CSSNodeListAdd(CSSNodeListRef list, CSSNodeRef node);
void CSSNodeListInsert(CSSNodeListRef list, CSSNodeRef node, uint32_t index);
CSSNodeRef CSSNodeListRemove(CSSNodeListRef list, uint32_t index);
CSSNodeRef CSSNodeListDelete(CSSNodeListRef list, CSSNodeRef node);
CSSNodeRef CSSNodeListGet(CSSNodeListRef list, uint32_t index);
CSSNodeListRef CSSNodeListNew(const uint32_t initialCapacity);
void CSSNodeListFree(const CSSNodeListRef list);
uint32_t CSSNodeListCount(const CSSNodeListRef list);
void CSSNodeListAdd(const CSSNodeListRef list, const CSSNodeRef node);
void CSSNodeListInsert(const CSSNodeListRef list, const CSSNodeRef node, const uint32_t index);
CSSNodeRef CSSNodeListRemove(const CSSNodeListRef list, const uint32_t index);
CSSNodeRef CSSNodeListDelete(const CSSNodeListRef list, const CSSNodeRef node);
CSSNodeRef CSSNodeListGet(const CSSNodeListRef list, const uint32_t index);
CSS_EXTERN_C_END