mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
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:
parent
76374ef352
commit
7eb717ffea
4 changed files with 48 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue