int index,i;
int       index = -1; int       i;
nsslowcert_UpdateSubjectEmailAddr(NSSLOWCERTCertDBHandle *dbhandle, 	SECItem *derSubject, char *emailAddr, nsslowcertUpdateType updateType){    PRBool save = PR_FALSE, delold = PR_FALSE;    certDBEntrySubject *entry = NULL;    int index,i;    SECStatus rv;       if (emailAddr) { 	emailAddr = nsslowcert_FixupEmailAddr(emailAddr);	if (emailAddr == NULL) {	    return SECFailure;	}    }    entry = ReadDBSubjectEntry(dbhandle,derSubject);        if (entry == NULL) {	goto loser;    }    if ( entry->emailAddrs ) {	for (i=0; i < entry->nemailAddrs; i++) {	    if (PORT_Strcmp(entry->emailAddrs[i],emailAddr) == 0) {		index = i;	    }	}    }    if (updateType == nsslowcert_remove) {	if (index == -1) {	    return SECSuccess;	}	entry->nemailAddrs--;	for (i=index; i < entry->nemailAddrs; i++) {	   entry->emailAddrs[i] = entry->emailAddrs[i+1];	}    } else {	char **newAddrs = NULL;	if (index != -1) {	    return SECSuccess;	}	newAddrs = (char **)PORT_ArenaAlloc(entry->common.arena,		(entry->nemailAddrs+1)* sizeof(char *));	if (!newAddrs) {	    goto loser;	}	for (i=0; i < entry->nemailAddrs; i++) {	   newAddrs[i] = entry->emailAddrs[i];	}	newAddrs[entry->nemailAddrs] = 			PORT_ArenaStrdup(entry->common.arena,emailAddr);	if (!newAddrs[entry->nemailAddrs]) {	   goto loser;	}	entry->emailAddrs = newAddrs;	entry->nemailAddrs++;    }	    /* delete the subject entry */    DeleteDBSubjectEntry(dbhandle, derSubject);    /* write the new one */    rv = WriteDBSubjectEntry(dbhandle, entry);    if ( rv != SECSuccess ) {	    goto loser;    }    DestroyDBEntry((certDBEntry *)entry);    if (emailAddr) PORT_Free(emailAddr);    return(SECSuccess);loser:    if (entry) DestroyDBEntry((certDBEntry *)entry);    if (emailAddr) PORT_Free(emailAddr);    return(SECFailure);}