mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
copy cache key in case it is mutated
This commit is contained in:
parent
8d2731c655
commit
2de7793dbc
2 changed files with 122 additions and 116 deletions
|
@ -51,7 +51,7 @@ gs_string_hash(const char *s)
|
|||
}
|
||||
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X) free(X.ptr)
|
||||
#define GSI_MAP_HASH(M, X) (gs_string_hash(X.ptr))
|
||||
#define GSI_MAP_EQUAL(M, X,Y) (strcmp(X.ptr, Y.ptr) == 0)
|
||||
#define GSI_MAP_KTYPES GSUNION_PTR
|
||||
|
@ -591,9 +591,15 @@ next_arg(const char *typePtr, NSArgumentInfo *info, char *outTypes)
|
|||
node = GSIMapNodeForKey(&cacheTable, (GSIMapKey)t);
|
||||
if (node == 0)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
sig = [[self alloc] _initWithObjCTypes: t];
|
||||
GSIMapAddPair(&cacheTable, (GSIMapKey)t, (GSIMapVal)(id)sig);
|
||||
} else {
|
||||
buf = malloc(strlen(t) + 1);
|
||||
strcpy(buf, t);
|
||||
GSIMapAddPair(&cacheTable, (GSIMapKey)buf, (GSIMapVal)(id)sig);
|
||||
}
|
||||
else
|
||||
{
|
||||
sig = RETAIN(node->value.obj);
|
||||
}
|
||||
GS_MUTEX_UNLOCK(cacheTableLock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue