Bugzilla bug 126087: removed symKey->refLock because we are using atomic

routines on symKey->refCount now.  Declare symKey->refCount as PRInt32 to
match the prototype of PR_AtomicIncrement/Decrement.
Modified files: pk11skey.c secmodti.h
This commit is contained in:
wtc%netscape.com 2002-04-17 01:03:23 +00:00
Родитель c79fd069a4
Коммит f971211696
2 изменённых файлов: 1 добавлений и 13 удалений

Просмотреть файл

@ -179,11 +179,6 @@ pk11_getKeyFromList(PK11SlotInfo *slot) {
if (symKey == NULL) {
return NULL;
}
symKey->refLock = PZ_NewLock(nssILockRefLock);
if (symKey->refLock == NULL) {
PORT_Free(symKey);
return NULL;
}
symKey->session = pk11_GetNewSession(slot,&symKey->sessionOwner);
symKey->next = NULL;
return symKey;
@ -198,7 +193,6 @@ PK11_CleanKeyList(PK11SlotInfo *slot)
symKey = slot->freeSymKeysHead;
slot->freeSymKeysHead = symKey->next;
pk11_CloseSession(slot, symKey->session,symKey->sessionOwner);
PK11_USE_THREADS(PZ_DestroyLock(symKey->refLock);)
PORT_Free(symKey);
};
return;
@ -242,14 +236,10 @@ PK11_CreateSymKey(PK11SlotInfo *slot, CK_MECHANISM_TYPE type, void *wincx)
void
PK11_FreeSymKey(PK11SymKey *symKey)
{
PRBool destroy = PR_FALSE;
PK11SlotInfo *slot;
PRBool freeit = PR_TRUE;
if (PR_AtomicDecrement(&symKey->refCount) == 0) {
destroy= PR_TRUE;
}
if (destroy) {
if ((symKey->owner) && symKey->objectID != CK_INVALID_HANDLE) {
pk11_EnterKeyMonitor(symKey);
(void) PK11_GETTAB(symKey->slot)->
@ -273,7 +263,6 @@ PK11_FreeSymKey(PK11SymKey *symKey)
if (freeit) {
pk11_CloseSession(symKey->slot, symKey->session,
symKey->sessionOwner);
PK11_USE_THREADS(PZ_DestroyLock(symKey->refLock);)
PORT_Free(symKey);
}
PK11_FreeSlot(slot);

Просмотреть файл

@ -145,8 +145,7 @@ struct PK11SymKeyStr {
SECItem data; /* raw key data if available */
CK_SESSION_HANDLE session;
PRBool sessionOwner;
int refCount; /* number of references to this key */
PZLock *refLock;
PRInt32 refCount; /* number of references to this key */
int size; /* key size in bytes */
PK11Origin origin; /* where this key came from
(see def in secmodt.h) */