2015-08-17 00:03:53 -05:00
|
|
|
// 17 august 2015
|
|
|
|
#import "uipriv_darwin.h"
|
|
|
|
|
2016-01-06 19:39:47 -06:00
|
|
|
// TODO are the NSValues (or worse, the NSMapTable) being garbage collected underfoot? open menuless window and check the checkbox; crash the package ui test when closing the main window; etc.
|
2015-11-28 11:16:05 -06:00
|
|
|
|
2015-08-17 00:03:53 -05:00
|
|
|
// unfortunately NSMutableDictionary copies its keys, meaning we can't use it for pointers
|
|
|
|
// hence, this file
|
|
|
|
|
|
|
|
NSMapTable *newMap(void)
|
|
|
|
{
|
2015-08-21 23:30:36 -05:00
|
|
|
return [NSMapTable mapTableWithKeyOptions:(NSPointerFunctionsOpaqueMemory | NSPointerFunctionsOpaquePersonality)
|
2015-08-17 00:03:53 -05:00
|
|
|
valueOptions:NSPointerFunctionsOpaqueMemory];
|
|
|
|
}
|
|
|
|
|
|
|
|
void *mapGet(NSMapTable *map, id key)
|
|
|
|
{
|
|
|
|
NSValue *v;
|
|
|
|
|
2015-08-17 00:41:04 -05:00
|
|
|
v = (NSValue *) [map objectForKey:key];
|
2015-08-17 00:03:53 -05:00
|
|
|
return [v pointerValue];
|
|
|
|
}
|
|
|
|
|
|
|
|
void mapSet(NSMapTable *map, id key, void *value)
|
|
|
|
{
|
|
|
|
NSValue *v;
|
|
|
|
|
|
|
|
v = [NSValue valueWithPointer:value];
|
|
|
|
[map setObject:v forKey:key];
|
|
|
|
}
|