mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Add some simple pointer functions personality tests
This commit is contained in:
parent
4629a4e1f6
commit
b677ea402a
4 changed files with 250 additions and 5 deletions
|
@ -186,6 +186,13 @@ relinquishRetainedMemory(const void *item,
|
|||
|
||||
- (id) initWithOptions: (NSPointerFunctionsOptions)options
|
||||
{
|
||||
#define Unsupported(X) ({\
|
||||
NSLog(@"*** An unsupported PointerFunctions configuration was requested,"\
|
||||
@" probably for use by NSMapTable, NSHashTable, or NSPointerArray. %@",\
|
||||
X);\
|
||||
DESTROY(self);\
|
||||
})
|
||||
|
||||
_x.options = options;
|
||||
|
||||
/* First we look at the memory management options to see which function
|
||||
|
@ -252,10 +259,18 @@ relinquishRetainedMemory(const void *item,
|
|||
}
|
||||
else if (personalityType(options, NSPointerFunctionsIntegerPersonality))
|
||||
{
|
||||
_x.acquireFunction = acquireExistingMemory;
|
||||
_x.descriptionFunction = describeInteger;
|
||||
_x.hashFunction = hashDirect;
|
||||
_x.isEqualFunction = equalDirect;
|
||||
if (memoryType(options, NSPointerFunctionsOpaqueMemory))
|
||||
{
|
||||
_x.acquireFunction = acquireExistingMemory;
|
||||
_x.descriptionFunction = describeInteger;
|
||||
_x.hashFunction = hashDirect;
|
||||
_x.isEqualFunction = equalDirect;
|
||||
}
|
||||
else
|
||||
{
|
||||
Unsupported(@"The requested configuration fails due to"
|
||||
@" integer personality not using opaque memory.");
|
||||
}
|
||||
}
|
||||
else /* objects */
|
||||
{
|
||||
|
@ -272,7 +287,6 @@ relinquishRetainedMemory(const void *item,
|
|||
_x.isEqualFunction = equalObject;
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue