git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32063 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-02-11 12:25:20 +00:00
parent 8b5dd696e4
commit 9ae02406b8
3 changed files with 33 additions and 19 deletions

View file

@ -1,3 +1,8 @@
2011-02-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSICUString.m:
Fix leak spotted by static analyser.
2011-02-11 12:06 David Chisnall <theraven@gna.org> 2011-02-11 12:06 David Chisnall <theraven@gna.org>
* libs/base/trunk/Source/GSPrivate.h: Added exception-safe version * libs/base/trunk/Source/GSPrivate.h: Added exception-safe version

View file

@ -11,6 +11,7 @@
* contents directly. * contents directly.
*/ */
UText* UTextInitWithNSString(UText *txt, NSString *str); UText* UTextInitWithNSString(UText *txt, NSString *str);
/** /**
* Initialises a UText structure with an NSMutableString. If txt is NULL, then * Initialises a UText structure with an NSMutableString. If txt is NULL, then
* this allocates a new structure on the heap, otherwise it fills in the * this allocates a new structure on the heap, otherwise it fills in the
@ -23,6 +24,7 @@ UText* UTextInitWithNSString(UText *txt, NSString *str);
* reflected in the underlying NSMutableString. * reflected in the underlying NSMutableString.
*/ */
UText* UTextInitWithNSMutableString(UText *txt, NSMutableString *str); UText* UTextInitWithNSMutableString(UText *txt, NSMutableString *str);
/** /**
* GSUTextString is an NSString subclass that is backed by a libicu UText * GSUTextString is an NSString subclass that is backed by a libicu UText
* structure. This class is intended to be used when returning UText created * structure. This class is intended to be used when returning UText created

View file

@ -263,12 +263,19 @@ UTextNSMutableStringClone(UText *dest,
UErrorCode *status) UErrorCode *status)
{ {
NSMutableString *str = (NSMutableString*)src->p; NSMutableString *str = (NSMutableString*)src->p;
UText *txt;
if (deep) if (deep)
{ {
str = [str mutableCopy]; str = [str mutableCopy];
txt = UTextInitWithNSMutableString(dest, str);
[str release];
} }
return UTextInitWithNSMutableString(dest, str); else
{
txt = UTextInitWithNSMutableString(dest, str);
}
return txt;
} }
/** /**