mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Revert back to working code!
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32072 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b21d800c2a
commit
e679d4e99e
13 changed files with 57 additions and 71 deletions
|
@ -11,7 +11,6 @@
|
|||
* contents directly.
|
||||
*/
|
||||
UText* UTextInitWithNSString(UText *txt, NSString *str);
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -24,7 +23,6 @@ UText* UTextInitWithNSString(UText *txt, NSString *str);
|
|||
* reflected in the underlying NSMutableString.
|
||||
*/
|
||||
UText* UTextInitWithNSMutableString(UText *txt, NSMutableString *str);
|
||||
|
||||
/**
|
||||
* GSUTextString is an NSString subclass that is backed by a libicu UText
|
||||
* structure. This class is intended to be used when returning UText created
|
||||
|
@ -32,9 +30,9 @@ UText* UTextInitWithNSMutableString(UText *txt, NSMutableString *str);
|
|||
*/
|
||||
@interface GSUTextString : NSString
|
||||
{
|
||||
@public
|
||||
/** The UText structure containing the libicu string interface. */
|
||||
UText txt;
|
||||
@public
|
||||
/** The UText structure containing the libicu string interface. */
|
||||
UText txt;
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -45,9 +43,9 @@ UText* UTextInitWithNSMutableString(UText *txt, NSMutableString *str);
|
|||
*/
|
||||
@interface GSUTextMutableString : NSMutableString
|
||||
{
|
||||
@public
|
||||
/** The UText structure containing the libicu string interface. */
|
||||
UText txt;
|
||||
@public
|
||||
/** The UText structure containing the libicu string interface. */
|
||||
UText txt;
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -56,10 +54,10 @@ UText* UTextInitWithNSMutableString(UText *txt, NSMutableString *str);
|
|||
*/
|
||||
static inline void free_string(unichar **buf)
|
||||
{
|
||||
if (0 != *buf)
|
||||
{
|
||||
free(*buf);
|
||||
}
|
||||
if (0 != *buf)
|
||||
{
|
||||
free(*buf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,12 +68,12 @@ static inline void free_string(unichar **buf)
|
|||
* Buffers created in this way are exception safe when using native exceptions.
|
||||
*/
|
||||
#define TEMP_BUFFER(name, size)\
|
||||
__attribute__((cleanup(free_string))) unichar *name ##_onheap = 0;\
|
||||
unichar name ## _onstack[64 / sizeof(unichar)];\
|
||||
unichar *name = name ## _onstack;\
|
||||
if (size > 64)\
|
||||
{\
|
||||
name ## _onheap = malloc(size);\
|
||||
name = name ## _onheap;\
|
||||
}
|
||||
__attribute__((cleanup(free_string))) unichar *name ##_onheap = 0;\
|
||||
unichar name ## _onstack[64 / sizeof(unichar)];\
|
||||
unichar *name = name ## _onstack;\
|
||||
if (size > 64)\
|
||||
{\
|
||||
name ## _onheap = malloc(size);\
|
||||
name = name ## _onheap;\
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue