Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Consistently use NSInteger typedefs

NSInteger != int on all platforms; native types (e.g. NSInteger) should
generally be preferred for platform agnostic code.
  • Loading branch information...
commit 342e3d4ea853924bae2ff8591e5bee54632f295c 1 parent 64c8e0d
Cameron Desautels camdez authored
Showing with 8 additions and 8 deletions.
  1. +6 −6 EDSemver/EDSemver.m
  2. +2 −2 Project/semverTests/EDSemverBenchmark.m
12 EDSemver/EDSemver.m
View
@@ -10,9 +10,9 @@
@interface EDSemver ()
@property (readwrite) BOOL isValid;
-@property (readwrite) int major;
-@property (readwrite) int minor;
-@property (readwrite) int patch;
+@property (readwrite) NSInteger major;
+@property (readwrite) NSInteger minor;
+@property (readwrite) NSInteger patch;
@property (readwrite) NSString *prerelease;
@property (readwrite) NSString *build;
@property (readwrite) NSArray *pr;
@@ -64,9 +64,9 @@ - (instancetype)initWithString:(NSString *)aString
// Check & set properties
_isValid = [self check];
if (_isValid) {
- _major = [_version[0] intValue];
- _minor = [_version[1] intValue];
- _patch = [_version[2] intValue];
+ _major = [_version[0] integerValue];
+ _minor = [_version[1] integerValue];
+ _patch = [_version[2] integerValue];
_prerelease = _version[3];
_build = _version[4];
_pr = [self parse:_prerelease strict:NO];
4 Project/semverTests/EDSemverBenchmark.m
View
@@ -22,13 +22,13 @@ @implementation EDSemverBenchmark
- (void)setUp
{
[super setUp];
-
+
_list = @[@"1.2.3", @"v1.2.3", @"1.2.3-foo", @"1.0.0-alpha", @"1.0-alpha", @"1-alpha", @" 1.2.3", @"1.2.3 ", @"v1.0.0-alpha", @"v1.2-alpha+123"];
}
- (void)testBenchmark
{
- for (int i = 0; i < 1000; i++) {
+ for (NSUInteger i = 0; i < 1000; i++) {
EDSemver *ver = [[EDSemver alloc] initWithString:[_list objectAtIndex:i % 10]];
STAssertTrue([ver isValid], VALID_DESC);
}
Please sign in to comment.
Something went wrong with that request. Please try again.