PRUint32 i; SECStatus secrv;
PRBool myList = PR_FALSE;
CERT_CreateSubjectCertList(CERTCertList *certList, CERTCertDBHandle *handle,			   SECItem *name, int64 sorttime, PRBool validOnly){    NSSCryptoContext *cc;    NSSCertificate **subjectCerts;    NSSCertificate *c;    NSSDER subject;    PRUint32 i;    SECStatus secrv;    cc = STAN_GetDefaultCryptoContext();    NSSITEM_FROM_SECITEM(&subject, name);    subjectCerts = NSSCryptoContext_FindCertificatesBySubject(cc,                                                              &subject,                                                              NULL,                                                              0,                                                              NULL);    if (!subjectCerts) {	subjectCerts = NSSTrustDomain_FindCertificatesBySubject(handle,	                                                        &subject,	                                                        NULL,	                                                        0,	                                                        NULL);	if (!subjectCerts) {	    return NULL;	}    }    i = 0;    if (certList == NULL && subjectCerts) {	certList = CERT_NewCertList();	if (!certList) goto loser;    }    while ((c = subjectCerts[i++])) {	CERTCertificate *cc = STAN_GetCERTCertificate(c);	if (!validOnly ||	     CERT_CheckCertValidTimes(cc, sorttime, PR_FALSE)                  == secCertTimeValid) {	    secrv = CERT_AddCertToListSorted(certList, cc, 	                                     CERT_SortCBValidity, 	                                     (void *)&sorttime);	    if (secrv != SECSuccess) {		CERT_DestroyCertificate(cc);		goto loser;	    }	} else {	    CERT_DestroyCertificate(cc);	}    }    nss_ZFreeIf(subjectCerts);    return certList;loser:    nss_ZFreeIf(subjectCerts);    if (certList != NULL) {	CERT_DestroyCertList(certList);    }    return NULL;}