Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 3 files changed
  • 0 comments
  • 1 contributor
Jun 07, 2011
eigentone11 eigentone11 correct memory management afba42d
eigentone11 eigentone11 correct ref counting
remove const qualifier from NSString arguments
follow published copy semantics
a3ffd4c

Showing 3 changed files with 26 additions and 9 deletions. Show diff stats Hide diff stats

  1. +1 1  OAConsumer.h
  2. +12 4 OAConsumer.m
  3. +13 4 OARequestParameter.m
2  OAConsumer.h
@@ -35,7 +35,7 @@
35 35 @property(copy, readwrite) NSString *key;
36 36 @property(copy, readwrite) NSString *secret;
37 37
38   -- (id)initWithKey:(const NSString *)aKey secret:(const NSString *)aSecret;
  38 +- (id)initWithKey:(NSString *)aKey secret:(NSString *)aSecret;
39 39
40 40 - (BOOL)isEqualToConsumer:(OAConsumer *)aConsumer;
41 41
16 OAConsumer.m
@@ -31,13 +31,21 @@ @implementation OAConsumer
31 31
32 32 #pragma mark init
33 33
34   -- (id)initWithKey:(const NSString *)aKey secret:(const NSString *)aSecret {
35   - [super init];
36   - self.key = [aKey retain];
37   - self.secret = [aSecret retain];
  34 +- (id)initWithKey:(NSString *)aKey secret:(NSString *)aSecret {
  35 + self = [super init];
  36 + if (self != nil) {
  37 + key = [aKey copy];
  38 + secret = [aSecret copy];
  39 + }
38 40 return self;
39 41 }
40 42
  43 +- (void)dealloc {
  44 + [key release], key = nil;
  45 + [secret release], secret = nil;
  46 + [super dealloc];
  47 +}
  48 +
41 49 - (BOOL)isEqual:(id)object {
42 50 if ([object isKindOfClass:[self class]]) {
43 51 return [self isEqualToConsumer:(OAConsumer*)object];
17 OARequestParameter.m
@@ -31,12 +31,21 @@ @implementation OARequestParameter
31 31 @synthesize name, value;
32 32
33 33 - (id)initWithName:(NSString *)aName value:(NSString *)aValue {
34   - [super init];
35   - self.name = aName;
36   - self.value = aValue;
37   - return self;
  34 + self = [super init];
  35 + if (self != nil) {
  36 + name = [aName copy];
  37 + value = [aValue copy];
  38 + }
  39 + return self;
  40 +}
  41 +
  42 +- (void)dealloc {
  43 + [name release], name = nil;
  44 + [value release], value = nil;
  45 + [super dealloc];
38 46 }
39 47
  48 +
40 49 - (NSString *)URLEncodedName {
41 50 return self.name;
42 51 // return [self.name encodedURLParameterString];

No commit comments for this range

Something went wrong with that request. Please try again.