mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Make NSPropertyList.m use the temporary buffer macros, instead of reimplementing them.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32062 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b839f8fe27
commit
8b5dd696e4
1 changed files with 2 additions and 13 deletions
|
@ -1464,22 +1464,14 @@ PString(NSString *obj, NSMutableData *output)
|
||||||
else if ([obj rangeOfCharacterFromSet: oldQuotables].length > 0
|
else if ([obj rangeOfCharacterFromSet: oldQuotables].length > 0
|
||||||
|| [obj characterAtIndex: 0] == '/')
|
|| [obj characterAtIndex: 0] == '/')
|
||||||
{
|
{
|
||||||
unichar tmp[length <= 1024 ? length : 0];
|
|
||||||
unichar *ustring;
|
unichar *ustring;
|
||||||
unichar *from;
|
unichar *from;
|
||||||
unichar *end;
|
unichar *end;
|
||||||
unsigned char *ptr;
|
unsigned char *ptr;
|
||||||
int base = [output length];
|
int base = [output length];
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
GS_BEGINITEMBUF(tmp, (length * sizeof(unichar)), unichar)
|
||||||
|
|
||||||
if (length <= 1024)
|
|
||||||
{
|
|
||||||
ustring = tmp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ustring = NSAllocateCollectable(sizeof(unichar) * length, 0);
|
|
||||||
}
|
|
||||||
end = &ustring[length];
|
end = &ustring[length];
|
||||||
[obj getCharacters: ustring];
|
[obj getCharacters: ustring];
|
||||||
for (from = ustring; from < end; from++)
|
for (from = ustring; from < end; from++)
|
||||||
|
@ -1581,10 +1573,7 @@ PString(NSString *obj, NSMutableData *output)
|
||||||
}
|
}
|
||||||
*ptr++ = '"';
|
*ptr++ = '"';
|
||||||
|
|
||||||
if (ustring != tmp)
|
GS_ENDITEMBUF();
|
||||||
{
|
|
||||||
NSZoneFree(NSDefaultMallocZone(), ustring);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue