diff options
author | wtc%netscape.com <devnull@localhost> | 2003-02-20 16:58:57 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2003-02-20 16:58:57 +0000 |
commit | f78f1fb55c25913f5524a909be28782b5c540d99 (patch) | |
tree | df61d5a36e2f8b3191c8b36e71bfc6ef77d8e090 | |
parent | 901fa18081ec6968e4283ebae17fb6322ee41303 (diff) | |
download | nss-hg-f78f1fb55c25913f5524a909be28782b5c540d99.tar.gz |
Bug 194222: Removed SECMOD_CallOnce. It is replaced by the new NSPR 4.3
function PR_CallOnceWithArg.
Modified files: nss/nssinit.c pk11wrap/pk11cert.c pk11wrap/secmodi.h
-rw-r--r-- | security/nss/lib/nss/nssinit.c | 2 | ||||
-rw-r--r-- | security/nss/lib/pk11wrap/pk11cert.c | 65 | ||||
-rw-r--r-- | security/nss/lib/pk11wrap/secmodi.h | 16 |
3 files changed, 7 insertions, 76 deletions
diff --git a/security/nss/lib/nss/nssinit.c b/security/nss/lib/nss/nssinit.c index c2f72091a..f06c1159a 100644 --- a/security/nss/lib/nss/nssinit.c +++ b/security/nss/lib/nss/nssinit.c @@ -481,7 +481,6 @@ loser: #endif pk11sdr_Init(); cert_CreateSubjectKeyIDHashTable(); - SECMOD_InitCallOnce(); nss_IsInitted = PR_TRUE; } return rv; @@ -555,7 +554,6 @@ NSS_Shutdown(void) SECOID_Shutdown(); status = STAN_Shutdown(); cert_DestroySubjectKeyIDHashTable(); - SECMOD_CleanupCallOnce(); rv = SECMOD_Shutdown(); pk11sdr_Shutdown(); if (status == PR_FAILURE) { diff --git a/security/nss/lib/pk11wrap/pk11cert.c b/security/nss/lib/pk11wrap/pk11cert.c index be06ceae9..449fe17c8 100644 --- a/security/nss/lib/pk11wrap/pk11cert.c +++ b/security/nss/lib/pk11wrap/pk11cert.c @@ -2341,9 +2341,9 @@ loser: return NULL; } -static SECMODCallOnceType keyIDHashCallOnce; +static PRCallOnceType keyIDHashCallOnce; -static SECStatus PR_CALLBACK +static PRStatus PR_CALLBACK pk11_keyIDHash_populate(void *wincx) { CERTCertList *certList; @@ -2352,7 +2352,7 @@ pk11_keyIDHash_populate(void *wincx) certList = PK11_ListCerts(PK11CertListUser, wincx); if (!certList) { - return SECFailure; + return PR_FAILURE; } for (node = CERT_LIST_HEAD(certList); @@ -2366,7 +2366,7 @@ pk11_keyIDHash_populate(void *wincx) } } CERT_DestroyCertList(certList); - return SECSuccess; + return PR_SUCCESS; } /* @@ -2379,11 +2379,11 @@ PK11_FindCertAndKeyByRecipientListNew(NSSCMSRecipient **recipientlist, void *win { CERTCertificate *cert; NSSCMSRecipient *rl; - SECStatus srv; + PRStatus rv; int rlIndex; - srv = SECMOD_CallOnce(&keyIDHashCallOnce, pk11_keyIDHash_populate, wincx); - if (srv != SECSuccess) + rv = PR_CallOnceWithArg(&keyIDHashCallOnce, pk11_keyIDHash_populate, wincx); + if (rv != PR_SUCCESS) return -1; cert = pk11_AllFindCertObjectByRecipientNew(recipientlist, wincx, &rlIndex); @@ -4156,54 +4156,3 @@ CERTSignedCrl* PK11_ImportCRL(PK11SlotInfo * slot, SECItem *derCRL, char *url, } return (crl); } - -/* - * This code takes the NSPR CallOnce functionality and modifies it so - * that we can pass an argument to our function - */ -static struct { - PRLock *ml; - PRCondVar *cv; -} mod_init; - -void SECMOD_InitCallOnce(void) { - mod_init.ml = PR_NewLock(); - PORT_Assert(NULL != mod_init.ml); - mod_init.cv = PR_NewCondVar(mod_init.ml); - PORT_Assert(NULL != mod_init.cv); -} - -void SECMOD_CleanupCallOnce(void) -{ - if (mod_init.ml) { - PR_DestroyLock(mod_init.ml); - mod_init.ml = NULL; - } - if (mod_init.cv) { - PR_DestroyCondVar(mod_init.cv); - mod_init.cv = NULL; - } -} - -SECStatus SECMOD_CallOnce(SECMODCallOnceType *once, - SECMODCallOnceFN func, - void *arg) -{ - - if (!once->initialized) { - if (PR_AtomicSet(&once->inProgress, 1) == 0) { - once->status = (PRStatus)(*func)(arg); - PR_Lock(mod_init.ml); - once->initialized = 1; - PR_NotifyAllCondVar(mod_init.cv); - PR_Unlock(mod_init.ml); - } else { - PR_Lock(mod_init.ml); - while (!once->initialized) { - PR_WaitCondVar(mod_init.cv, PR_INTERVAL_NO_TIMEOUT); - } - PR_Unlock(mod_init.ml); - } - } - return once->status; -} diff --git a/security/nss/lib/pk11wrap/secmodi.h b/security/nss/lib/pk11wrap/secmodi.h index 539731d67..f7854a250 100644 --- a/security/nss/lib/pk11wrap/secmodi.h +++ b/security/nss/lib/pk11wrap/secmodi.h @@ -111,22 +111,6 @@ SECStatus PBE_PK11ParamToAlgid(SECOidTag algTag, SECItem *param, extern void pk11sdr_Init(void); extern void pk11sdr_Shutdown(void); -typedef struct SECMODCallOnceType { - PRIntn initialized; - PRInt32 inProgress; - SECStatus status; -} SECMODCallOnceType; - -typedef SECStatus (PR_CALLBACK *SECMODCallOnceFN)(void *arg); - -extern void SECMOD_InitCallOnce(void); - -extern SECStatus SECMOD_CallOnce(SECMODCallOnceType *once, - SECMODCallOnceFN func, - void *arg); - -extern void SECMOD_CleanupCallOnce(void); - SEC_END_PROTOS #endif |