зеркало из https://github.com/mozilla/pjs.git
detect hash collisions so that the caller can handle it
This commit is contained in:
Родитель
b86f9eeb4b
Коммит
276a29db57
|
@ -35,7 +35,7 @@
|
|||
#define BASE_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char BASE_CVS_ID[] = "@(#) $RCSfile: base.h,v $ $Revision: 1.10 $ $Date: 2001-11-28 16:23:34 $ $Name: $";
|
||||
static const char BASE_CVS_ID[] = "@(#) $RCSfile: base.h,v $ $Revision: 1.11 $ $Date: 2001-12-12 20:23:05 $ $Name: $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
|
@ -1055,6 +1055,9 @@ nssHash_Destroy
|
|||
* nssHash_Add
|
||||
*
|
||||
*/
|
||||
|
||||
extern const NSSError NSS_ERROR_HASH_COLLISION;
|
||||
|
||||
NSS_EXTERN PRStatus
|
||||
nssHash_Add
|
||||
(
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: errorval.c,v $ $Revision: 1.5 $ $Date: 2001-12-10 19:14:32 $ $Name: $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: errorval.c,v $ $Revision: 1.6 $ $Date: 2001-12-12 20:23:06 $ $Name: $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
|
@ -85,3 +85,5 @@ const NSSError NSS_ERROR_CERTIFICATE_ISSUER_NOT_FOUND = 31;
|
|||
|
||||
const NSSError NSS_ERROR_CERTIFICATE_IN_CACHE = 32;
|
||||
|
||||
const NSSError NSS_ERROR_HASH_COLLISION = 33;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.5 $ $Date: 2001-11-29 19:33:59 $ $Name: $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.6 $ $Date: 2001-12-12 20:23:07 $ $Name: $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
|
@ -246,7 +246,7 @@ nssHash_Add
|
|||
const void *value
|
||||
)
|
||||
{
|
||||
PRStatus error = PR_SUCCESS;
|
||||
PRStatus error = PR_FAILURE;
|
||||
PLHashEntry *he;
|
||||
|
||||
PZ_Lock(hash->mutex);
|
||||
|
@ -254,8 +254,11 @@ nssHash_Add
|
|||
he = PL_HashTableAdd(hash->plHashTable, key, (void *)value);
|
||||
if( (PLHashEntry *)NULL == he ) {
|
||||
nss_SetError(NSS_ERROR_NO_MEMORY);
|
||||
} else if (he->value != value) {
|
||||
nss_SetError(NSS_ERROR_HASH_COLLISION);
|
||||
} else {
|
||||
hash->count++;
|
||||
error = PR_SUCCESS;
|
||||
}
|
||||
|
||||
(void)PZ_Unlock(hash->mutex);
|
||||
|
|
Загрузка…
Ссылка в новой задаче