Name server minor safety and performance tweak

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37956 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2014-06-20 14:17:17 +00:00
parent d84396b484
commit c219158181
3 changed files with 22 additions and 3 deletions

View file

@ -590,7 +590,12 @@ typedef enum {
}
s = (NSSocketPortNameServer*)NSAllocateObject(self, 0,
NSDefaultMallocZone());
s->_portMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
/* Use NSNonOwnedPointerMapKeyCallBacks for the ports used as keys
* since we want as pointer test for equality as we may be doing
* lookup while dealocating the port (in which case the -isEqual:
* method could fail).
*/
s->_portMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSObjectMapValueCallBacks, 0);
s->_nameMap = NSCreateMapTable(NSObjectMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0);