Avoid memory leaks by implementing hash and isEqual: for credentials

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23088 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-06-19 15:37:50 +00:00
parent 76374ef352
commit 7eb717ffea
4 changed files with 48 additions and 4 deletions

View file

@ -91,6 +91,11 @@ typedef struct {
return this->hasPassword;
}
- (unsigned) hash
{
return [this->user hash];
}
- (id) initWithUser: (NSString *)user
password: (NSString *)password
persistence: (NSURLCredentialPersistence)persistence
@ -114,6 +119,19 @@ typedef struct {
return self;
}
- (BOOL) isEqual: (id)other
{
if ((id)self == other)
{
return YES;
}
if ([other isKindOfClass: [NSURLCredential class]] == NO)
{
return NO;
}
return [[(NSURLCredential*)other user] isEqualToString: this->user];
}
- (NSString *) password
{
return this->password;