return version;
}
+// XXX: rename this to involve "Create"
CFStringRef StripVersion(const char *version) {
const char *colon(strchr(version, ':'));
if (colon != NULL)
}
- (void) dealloc {
+ // XXX: this is a very inefficient way to call these deconstructors
[self _clear];
[super dealloc];
}
bool parsed_;
CYString section_;
- NSString *section$_;
+ _transient NSString *section$_;
bool essential_;
bool required_;
bool visible_;
tags_ = [[NSMutableArray alloc] initWithCapacity:8];
do {
const char *name(tag.Name());
- [tags_ addObject:(NSString *)CYStringCreate(name)];
+ [tags_ addObject:[(NSString *)CYStringCreate(name) autorelease]];
if (role_ == nil && strncmp(name, "role::", 6) == 0 /*&& strcmp(name, "role::leaper") != 0*/)
role_ = (NSString *) CYStringCreate(name + 6);
if (required_ && strncmp(name, "require::", 9) == 0 && (
}
- (void) dealloc {
+ // XXX: actually implement this thing
_assert(false);
NSRecycleZone(zone_);
// XXX: malloc_destroy_zone(zone_);
[NSThread
detachNewThreadSelector:@selector(_readCydia:)
toTarget:self
- withObject:[[NSNumber numberWithInt:fds[0]] retain]
+ withObject:[NSNumber numberWithInt:fds[0]]
];
_assert(pipe(fds) != -1);
[NSThread
detachNewThreadSelector:@selector(_readStatus:)
toTarget:self
- withObject:[[NSNumber numberWithInt:fds[0]] retain]
+ withObject:[NSNumber numberWithInt:fds[0]]
];
_assert(pipe(fds) != -1);
[NSThread
detachNewThreadSelector:@selector(_readOutput:)
toTarget:self
- withObject:[[NSNumber numberWithInt:fds[0]] retain]
+ withObject:[NSNumber numberWithInt:fds[0]]
];
} return self;
}
/* Web Scripting {{{ */
@interface CydiaObject : NSObject {
id indirect_;
- id delegate_;
+ _transient id delegate_;
}
- (id) initWithDelegate:(IndirectDelegate *)indirect;
/* Progress Data {{{ */
@interface ProgressData : NSObject {
SEL selector_;
- id target_;
- id object_;
+ // XXX: should these really both be _transient?
+ _transient id target_;
+ _transient id object_;
}
- (ProgressData *) initWithSelector:(SEL)selector target:(id)target object:(id)object;
- (void) _detachNewThreadData:(ProgressData *)data { _pooled
[[data target] performSelector:[data selector] withObject:[data object]];
- [data release];
-
[self performSelectorOnMainThread:@selector(_retachThread) withObject:nil waitUntilDone:YES];
}
[NSThread
detachNewThreadSelector:@selector(_detachNewThreadData:)
toTarget:self
- withObject:[[ProgressData alloc]
+ withObject:[[[ProgressData alloc]
initWithSelector:selector
target:target
object:object
- ]
+ ] autorelease]
];
}
UITableView *list_;
NSMutableArray *index_;
NSMutableDictionary *indices_;
- id target_;
+ // XXX: this target_ seems to be delegate_. :(
+ _transient id target_;
SEL action_;
- id delegate_;
+ // XXX: why do we even have this delegate_?
+ _transient id delegate_;
}
- (id) initWithFrame:(CGRect)frame database:(Database *)database target:(id)target action:(SEL)action;
@implementation SourceTable
-- (void) _deallocConnection:(NSURLConnection *)connection {
+- (void) _releaseConnection:(NSURLConnection *)connection {
if (connection != nil) {
[connection cancel];
//[connection setDelegate:nil];
if (error_ != nil)
[error_ release];
- //[self _deallocConnection:installer_];
- [self _deallocConnection:trivial_];
- [self _deallocConnection:trivial_gz_];
- [self _deallocConnection:trivial_bz2_];
- //[self _deallocConnection:automatic_];
+ //[self _releaseConnection:installer_];
+ [self _releaseConnection:trivial_];
+ [self _releaseConnection:trivial_gz_];
+ [self _releaseConnection:trivial_bz2_];
+ //[self _releaseConnection:automatic_];
[sources_ release];
[list_ release];
}
- (void) _endConnection:(NSURLConnection *)connection {
+ // XXX: the memory management in this method is horribly awkward
+
NSURLConnection **field = NULL;
if (connection == trivial_)
field = &trivial_;
cydia_ = false;
+ // XXX: this is stupid
hud_ = [[delegate_ addProgressHUD] retain];
[hud_ setText:UCLocalize("VERIFYING_URL")];
} break;
@implementation RefreshBar
+- (void) dealloc {
+ [indicator_ release];
+ [prompt_ release];
+ [progress_ release];
+ [cancel_ release];
+ [super dealloc];
+}
+
- (void) positionViews {
CGRect frame = [cancel_ frame];
frame.origin.x = [self frame].size.width - frame.size.width - 5;
/* Cydia Tab Bar Controller {{{ */
@interface CYTabBarController : UITabBarController {
- Database *database_;
+ _transient Database *database_;
}
@end
/* Cydia Navigation Controller {{{ */
@interface CYNavigationController : UINavigationController {
_transient Database *database_;
- id<UINavigationControllerDelegate> delegate_;
+ _transient id<UINavigationControllerDelegate> delegate_;
}
- (id) initWithDatabase:(Database *)database;
UITableViewDelegate
> {
_transient Database *database_;
- id roledelegate_;
+ // XXX: ok, "roledelegate_"?...
+ _transient id roledelegate_;
UITableView *table_;
UISegmentedControl *segment_;
UIView *container_;
/* }}} */
/* Stash Controller {{{ */
@interface CYStashController : CYViewController {
- UIActivityIndicatorView *spinner_;
- UILabel *status_;
- UILabel *caption_;
+ // XXX: just delete these things
+ _transient UIActivityIndicatorView *spinner_;
+ _transient UILabel *status_;
+ _transient UILabel *caption_;
}
@end
bool dropped_;
bool updating_;
- NSObject<CydiaDelegate> *updatedelegate_;
- UITabBarController *root_;
+ // XXX: ok, "updatedelegate_"?...
+ _transient NSObject<CydiaDelegate> *updatedelegate_;
+ // XXX: can't we query for this variable when we need it?
+ _transient UITabBarController *root_;
}
- (void) setTabBarController:(UITabBarController *)controller;
UINavigationControllerDelegate,
UITabBarControllerDelegate
> {
+ // XXX: evaluate all fields for _transient
+
UIWindow *window_;
CYContainer *container_;
CYTabBarController *tabbar_;
ConfirmationController *page([[[ConfirmationController alloc] initWithDatabase:database_] autorelease]);
[page setDelegate:self];
- CYNavigationController *confirm_ = [[CYNavigationController alloc] initWithRootViewController:page];
+ CYNavigationController *confirm_([[[CYNavigationController alloc] initWithRootViewController:page] autorelease]);
[confirm_ setDelegate:self];
if (IsWildcat_) [confirm_ setModalPresentationStyle:UIModalPresentationFormSheet];
}
- (void) showSettings {
- RoleController *role = [[RoleController alloc] initWithDatabase:database_ delegate:self];
- CYNavigationController *nav = [[CYNavigationController alloc] initWithRootViewController:role];
+ RoleController *role = [[[RoleController alloc] initWithDatabase:database_ delegate:self] autorelease];
+ CYNavigationController *nav = [[[CYNavigationController alloc] initWithRootViewController:role] autorelease];
if (IsWildcat_) [nav setModalPresentationStyle:UIModalPresentationFormSheet];
[container_ presentModalViewController:nav animated:YES];
}
false
) {
[self addStashController];
+ // XXX: this would be much cleaner as a yieldToSelector:
+ // that way the removeStashController could happen right here inline
+ // we also could no longer require the useless stash_ field anymore
[self performSelector:@selector(stash) withObject:nil afterDelay:0];
return;
}
if (challenge_ != nil)
[challenge_ release];
+ if (request_ != nil)
+ [request_ release];
+
//NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
if (custom_ != nil)
if (closer_ != nil)
[closer_ release];
- if (sensitive_ != nil)
- [sensitive_ release];
if (title_ != nil)
[title_ release];
+ [loading_ release];
+
[reloaditem_ release];
[loadingitem_ release];
- (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function {
if (custom_ != nil)
[custom_ autorelease];
- custom_ = button == nil ? nil : [[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:button]]] retain];
+ if (button == nil)
+ custom_ = nil;
+ else
+ custom_ = [[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:button]]] retain];
if (style_ != nil)
[style_ autorelease];
- style_ = style == nil ? nil : [style retain];
+ if (style == nil)
+ style_ = nil;
+ else
+ style_ = [style retain];
if (function_ != nil)
[function_ autorelease];
- function_ = function == nil ? nil : [function retain];
+ if (function == nil)
+ function_ = nil;
+ else
+ function_ = [function retain];
[self applyRightButton];
}
- (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function {
if (custom_ != nil)
[custom_ autorelease];
- custom_ = button == nil ? nil : [button retain];
+ if (button == nil)
+ custom_ = nil;
+ else
+ custom_ = [button retain];
if (style_ != nil)
[style_ autorelease];
- style_ = style == nil ? nil : [style retain];
+ if (style == nil)
+ style_ = nil;
+ else
+ style_ = [style retain];
if (function_ != nil)
[function_ autorelease];
- function_ = function == nil ? nil : [function retain];
+ if (function == nil)
+ function_ = nil;
+ else
+ function_ = [function retain];
[self applyRightButton];
}
- (void) setPopupHook:(id)function {
if (closer_ != nil)
[closer_ autorelease];
- closer_ = function == nil ? nil : [function retain];
+ if (function == nil)
+ closer_ = nil;
+ else
+ closer_ = [function retain];
}
- (void) setViewportWidth:(float)width {
if ([frame parentFrame] != nil)
return;
+ if (title_ != nil)
+ [title_ autorelease];
title_ = [title retain];
+
[[self navigationItem] setTitle:title_];
}
- (void) applyRightButton {
if ([self isLoading]) {
[[self navigationItem] setRightBarButtonItem:loadingitem_ animated:YES];
- // XXX: why do we do this again here?
+ // XXX: why do we do this again here? (if we don't, just remove indicator_)
[[loadingitem_ view] addSubview:indicator_];
[self applyLoadingTitle];
} else if (custom_ != nil) {