mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Avoid leaking NXConstantStrings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4452 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4a690610ec
commit
1158a581b1
2 changed files with 15 additions and 8 deletions
|
@ -1097,22 +1097,22 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
|||
* archive and readi it back, the new copy will never be deallocated -
|
||||
* causing a memory leak. So we tell the system to use the super class.
|
||||
*/
|
||||
- (Class)classForArchiver
|
||||
- (Class) classForArchiver
|
||||
{
|
||||
return [self superclass];
|
||||
}
|
||||
|
||||
- (Class)classForCoder
|
||||
- (Class) classForCoder
|
||||
{
|
||||
return [self superclass];
|
||||
}
|
||||
|
||||
- (Class)classForPortCoder
|
||||
- (Class) classForPortCoder
|
||||
{
|
||||
return [self superclass];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
- (void) dealloc
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1136,6 +1136,11 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
|||
return self;
|
||||
}
|
||||
|
||||
- copy
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
- copyWithZone: (NSZone*)z
|
||||
{
|
||||
return self;
|
||||
|
|
|
@ -697,7 +697,7 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
[self getCharacters: s];
|
||||
[aString getCharacters: s+len];
|
||||
tmp = [[[self class] allocWithZone: z] initWithCharactersNoCopy: s
|
||||
tmp = [[NSString_concrete_class allocWithZone: z] initWithCharactersNoCopy: s
|
||||
length: len+otherLength fromZone: z];
|
||||
return AUTORELEASE(tmp);
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ handle_printf_atsign (FILE *stream,
|
|||
z = fastZone(self);
|
||||
buf = NSZoneMalloc(z, sizeof(unichar)*aRange.length);
|
||||
[self getCharacters: buf range: aRange];
|
||||
ret = [[[self class] allocWithZone: NSDefaultMallocZone()]
|
||||
ret = [[NSString_concrete_class allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCharactersNoCopy: buf length: aRange.length fromZone: z];
|
||||
return AUTORELEASE(ret);
|
||||
}
|
||||
|
@ -1293,7 +1293,8 @@ handle_printf_atsign (FILE *stream,
|
|||
s = NSZoneMalloc(z, sizeof(unichar)*(len+1));
|
||||
for (count = 0; count < len; count++)
|
||||
s[count] = uni_tolower([self characterAtIndex: count]);
|
||||
return AUTORELEASE([[[self class] allocWithZone: NSDefaultMallocZone()]
|
||||
return AUTORELEASE([[NSString_concrete_class
|
||||
allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCharactersNoCopy: s length: len fromZone: z]);
|
||||
}
|
||||
|
||||
|
@ -1307,7 +1308,8 @@ handle_printf_atsign (FILE *stream,
|
|||
s = NSZoneMalloc(z, sizeof(unichar)*(len+1));
|
||||
for (count = 0; count < len; count++)
|
||||
s[count] = uni_toupper([self characterAtIndex: count]);
|
||||
return AUTORELEASE([[[self class] allocWithZone: NSDefaultMallocZone()]
|
||||
return AUTORELEASE([[NSString_concrete_class
|
||||
allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCharactersNoCopy: s length: len fromZone: z]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue