Permalink
Browse files

Retain the base URL instead of copying it

Also, avoid creating a new string everytime a call is pushed if
there's no base url for the manager
  • Loading branch information...
1 parent d8892c5 commit f8dff016b876ae0a93149ae6d36bfceb8973ca9e @fiam committed Jun 16, 2010
Showing with 5 additions and 15 deletions.
  1. +1 −1 RCManager.h
  2. +4 −14 RCManager.m
View
@@ -16,7 +16,7 @@
id <NSObject> delegate_;
}
-@property(nonatomic, copy) NSString *baseURL;
+@property(nonatomic, retain) NSString *baseURL;
@property(nonatomic, assign) id <NSObject> delegate;
- (id)initWithBaseURL:(NSString *)theBaseURL;
View
@@ -42,18 +42,6 @@ - (void)dealloc {
[super dealloc];
}
-- (void)setBaseURL:(NSString *)theBaseURL {
- if (!theBaseURL) {
- theBaseURL = @"";
- }
-
- [self willChangeValueForKey:@"baseURL"];
- NSString *copy = [theBaseURL copy];
- [baseURL_ release];
- baseURL_ = copy;
- [self didChangeValueForKey:@"baseURL"];
-}
-
- (void)mayHideNetworkIndicator {
if (managedCalls_.count == 0) {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
@@ -93,8 +81,10 @@ - (void)cancelCallsForDelegate:(NSObject *)theDelegate {
- (void)pushCall:(RCCall *)theCall {
theCall.manager = self;
- theCall.delegate = self.delegate;
- theCall.callURL = [self.baseURL stringByAppendingString:theCall.callURL];
+ theCall.delegate = delegate_;
+ if (baseURL_) {
+ theCall.callURL = [baseURL_ stringByAppendingString:theCall.callURL];
+ }
@synchronized(managedCalls_) {
[managedCalls_ addObject:theCall];
if (managedCalls_.count == 1) {

0 comments on commit f8dff01

Please sign in to comment.