Skip to content

Commit

Permalink
[CGPointNull] Rename globally exported C function to avoid collisions…
Browse files Browse the repository at this point in the history
… #trivial (#62)

* [CGPointNull] Rename globally exported C function to avoid collisions.

Some other frameworks also declare this. Let's try to minimize collisions
without making the name too ugly.

* Fix build errors
  • Loading branch information
appleguy authored and Adlai-Holler committed Apr 27, 2017
1 parent fbb14f5 commit 32c036f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Source/Layout/ASLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ NS_ASSUME_NONNULL_BEGIN

ASDISPLAYNODE_EXTERN_C_BEGIN

extern CGPoint const CGPointNull;
extern CGPoint const ASPointNull; // {NAN, NAN}

extern BOOL CGPointIsNull(CGPoint point);
extern BOOL ASPointIsNull(CGPoint point);

/**
* Safely calculates the layout of the given root layoutElement by guarding against nil nodes.
Expand Down
12 changes: 6 additions & 6 deletions Source/Layout/ASLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#import <AsyncDisplayKit/ASObjectDescriptionHelpers.h>
#import <AsyncDisplayKit/ASRectTable.h>

CGPoint const CGPointNull = {NAN, NAN};
CGPoint const ASPointNull = {NAN, NAN};

extern BOOL CGPointIsNull(CGPoint point)
extern BOOL ASPointIsNull(CGPoint point)
{
return isnan(point.x) && isnan(point.y);
}
Expand Down Expand Up @@ -87,7 +87,7 @@ - (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement
if (self) {
#if DEBUG
for (ASLayout *sublayout in sublayouts) {
ASDisplayNodeAssert(CGPointIsNull(sublayout.position) == NO, @"Invalid position is not allowed in sublayout.");
ASDisplayNodeAssert(ASPointIsNull(sublayout.position) == NO, @"Invalid position is not allowed in sublayout.");
}
#endif

Expand All @@ -104,7 +104,7 @@ - (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement
}
_size = size;

if (CGPointIsNull(position) == NO) {
if (ASPointIsNull(position) == NO) {
_position = CGPointMake(ASCeilPixelValue(position.x), ASCeilPixelValue(position.y));
} else {
_position = position;
Expand Down Expand Up @@ -149,15 +149,15 @@ + (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement
{
return [self layoutWithLayoutElement:layoutElement
size:size
position:CGPointNull
position:ASPointNull
sublayouts:sublayouts];
}

+ (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement size:(CGSize)size
{
return [self layoutWithLayoutElement:layoutElement
size:size
position:CGPointNull
position:ASPointNull
sublayouts:nil];
}

Expand Down

0 comments on commit 32c036f

Please sign in to comment.