Fix a bunch of NSString bugs.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16636 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-05-05 13:36:25 +00:00
parent ab69a55361
commit 6c7f43d46d
3 changed files with 88 additions and 74 deletions

View file

@ -32,6 +32,7 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSBundle.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSException.h>
#include <Foundation/NSString.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSPathUtilities.h>
@ -1349,12 +1350,21 @@ tables:
ptr = NSZoneRealloc(zone, ptr, bytes);
}
}
else if (ptr == buf)
{
ptr = NULL;
result = NO;
}
*dst = ptr;
}
else if (ptr != buf && dst != 0 && ptr != *dst)
{
NSZoneFree(zone, ptr);
}
if (dst)
NSCAssert(*dst != buf, @"attempted to pass out pointer to internal buffer");
return result;
}
@ -1949,12 +1959,21 @@ tables:
ptr = NSZoneRealloc(zone, ptr, bytes);
}
}
else if (ptr == buf)
{
ptr = NULL;
result = NO;
}
*dst = ptr;
}
else if (ptr != buf && dst != 0 && ptr != *dst)
{
NSZoneFree(zone, ptr);
}
if (dst)
NSCAssert(*dst != buf, @"attempted to pass out pointer to internal buffer");
return result;
}