mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Fix another leak spotted by Quentin
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31779 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5842007417
commit
3f3fa66078
2 changed files with 13 additions and 8 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
* Source/NSString.m:
|
||||
([-stringByReplacingCharactersInRange:withString:]) fix memory leak.
|
||||
([-stringByReplacingOccurrencesOfString:withString:options:range:])
|
||||
ditto.
|
||||
|
||||
2010-12-25 Quentin Mathe <quentin.mathe@gmail.com>
|
||||
|
||||
|
|
|
@ -1774,21 +1774,24 @@ handle_printf_atsign (FILE *stream,
|
|||
return array;
|
||||
}
|
||||
|
||||
- (NSString*)stringByReplacingOccurrencesOfString: (NSString*)replace
|
||||
withString: (NSString*)by
|
||||
options: (NSStringCompareOptions)opts
|
||||
range: (NSRange)searchRange
|
||||
- (NSString*) stringByReplacingOccurrencesOfString: (NSString*)replace
|
||||
withString: (NSString*)by
|
||||
options: (NSStringCompareOptions)opts
|
||||
range: (NSRange)searchRange
|
||||
{
|
||||
id copy = [self mutableCopy];
|
||||
id copy;
|
||||
|
||||
copy = [[GSMutableStringClass allocWithZone: NSDefaultMallocZone()]
|
||||
initWithString: self];
|
||||
[copy replaceOccurrencesOfString: replace
|
||||
withString: by
|
||||
options: opts
|
||||
range: searchRange];
|
||||
return [copy makeImmutableCopyOnFail: NO];
|
||||
return [[copy makeImmutableCopyOnFail: NO] autorelease];
|
||||
}
|
||||
|
||||
- (NSString*)stringByReplacingOccurrencesOfString: (NSString*)replace
|
||||
withString: (NSString*)by
|
||||
- (NSString*) stringByReplacingOccurrencesOfString: (NSString*)replace
|
||||
withString: (NSString*)by
|
||||
{
|
||||
return [self
|
||||
stringByReplacingOccurrencesOfString: replace
|
||||
|
|
Loading…
Reference in a new issue