mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +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
be42e23da4
commit
87f29e1892
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 -
|
* 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.
|
* causing a memory leak. So we tell the system to use the super class.
|
||||||
*/
|
*/
|
||||||
- (Class)classForArchiver
|
- (Class) classForArchiver
|
||||||
{
|
{
|
||||||
return [self superclass];
|
return [self superclass];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (Class)classForCoder
|
- (Class) classForCoder
|
||||||
{
|
{
|
||||||
return [self superclass];
|
return [self superclass];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (Class)classForPortCoder
|
- (Class) classForPortCoder
|
||||||
{
|
{
|
||||||
return [self superclass];
|
return [self superclass];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1136,6 +1136,11 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- copy
|
||||||
|
{
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
- copyWithZone: (NSZone*)z
|
- copyWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -697,7 +697,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
|
|
||||||
[self getCharacters: s];
|
[self getCharacters: s];
|
||||||
[aString getCharacters: s+len];
|
[aString getCharacters: s+len];
|
||||||
tmp = [[[self class] allocWithZone: z] initWithCharactersNoCopy: s
|
tmp = [[NSString_concrete_class allocWithZone: z] initWithCharactersNoCopy: s
|
||||||
length: len+otherLength fromZone: z];
|
length: len+otherLength fromZone: z];
|
||||||
return AUTORELEASE(tmp);
|
return AUTORELEASE(tmp);
|
||||||
}
|
}
|
||||||
|
@ -763,7 +763,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
z = fastZone(self);
|
z = fastZone(self);
|
||||||
buf = NSZoneMalloc(z, sizeof(unichar)*aRange.length);
|
buf = NSZoneMalloc(z, sizeof(unichar)*aRange.length);
|
||||||
[self getCharacters: buf range: aRange];
|
[self getCharacters: buf range: aRange];
|
||||||
ret = [[[self class] allocWithZone: NSDefaultMallocZone()]
|
ret = [[NSString_concrete_class allocWithZone: NSDefaultMallocZone()]
|
||||||
initWithCharactersNoCopy: buf length: aRange.length fromZone: z];
|
initWithCharactersNoCopy: buf length: aRange.length fromZone: z];
|
||||||
return AUTORELEASE(ret);
|
return AUTORELEASE(ret);
|
||||||
}
|
}
|
||||||
|
@ -1293,7 +1293,8 @@ handle_printf_atsign (FILE *stream,
|
||||||
s = NSZoneMalloc(z, sizeof(unichar)*(len+1));
|
s = NSZoneMalloc(z, sizeof(unichar)*(len+1));
|
||||||
for (count = 0; count < len; count++)
|
for (count = 0; count < len; count++)
|
||||||
s[count] = uni_tolower([self characterAtIndex: 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]);
|
initWithCharactersNoCopy: s length: len fromZone: z]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1307,7 +1308,8 @@ handle_printf_atsign (FILE *stream,
|
||||||
s = NSZoneMalloc(z, sizeof(unichar)*(len+1));
|
s = NSZoneMalloc(z, sizeof(unichar)*(len+1));
|
||||||
for (count = 0; count < len; count++)
|
for (count = 0; count < len; count++)
|
||||||
s[count] = uni_toupper([self characterAtIndex: 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]);
|
initWithCharactersNoCopy: s length: len fromZone: z]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue