cbrv = (*callback)(tok, session, startOS[i], arg);
cbrv = (*callback)(tok, session, objectStack[i], arg);
traverse_objects_by_template(  NSSToken *tok,  nssSession *sessionOpt,  CK_ATTRIBUTE_PTR obj_template,  CK_ULONG otsize,  PRStatus (*callback)(NSSToken *t, nssSession *session,                       CK_OBJECT_HANDLE h, void *arg),  void *arg){    NSSSlot *slot;    PRStatus cbrv;    PRUint32 i;    CK_RV ckrv;    CK_ULONG count;    CK_OBJECT_HANDLE *objectStack;    CK_OBJECT_HANDLE startOS[OBJECT_STACK_SIZE];    CK_SESSION_HANDLE hSession;    NSSArena *objectArena = NULL;    nssSession *session;    nssList *objectList = NULL;    slot = tok->slot;    objectStack = startOS;    session = (sessionOpt) ? sessionOpt : tok->defaultSession;    hSession = session->handle;    nssSession_EnterMonitor(session);    ckrv = CKAPI(slot)->C_FindObjectsInit(hSession, obj_template, otsize);    if (ckrv != CKR_OK) {	nssSession_ExitMonitor(session);	goto loser;    }    while (PR_TRUE) {	ckrv = CKAPI(slot)->C_FindObjects(hSession, objectStack, 	                                  OBJECT_STACK_SIZE, &count);	if (ckrv != CKR_OK) {	    nssSession_ExitMonitor(session);	    goto loser;	}	if (count == OBJECT_STACK_SIZE) {	    if (!objectList) {		objectArena = NSSArena_Create();		objectList = nssList_Create(objectArena, PR_FALSE);	    }	    objectStack = nss_ZNEWARRAY(objectArena, CK_OBJECT_HANDLE, 	                                OBJECT_STACK_SIZE);	    nssList_Add(objectList, objectStack);	} else {	    break;	}    }    ckrv = CKAPI(slot)->C_FindObjectsFinal(hSession);    nssSession_ExitMonitor(session);    if (ckrv != CKR_OK) {	goto loser;    }    if (objectList) {	nssListIterator *objects;	objects = nssList_CreateIterator(objectList);	for (objectStack = (CK_OBJECT_HANDLE *)nssListIterator_Start(objects);	     objectStack != NULL;	     objectStack = (CK_OBJECT_HANDLE *)nssListIterator_Next(objects)) {	    for (i=0; i<count; i++) {		cbrv = (*callback)(tok, session, objectStack[i], arg);	    }	}	nssListIterator_Finish(objects);	nssListIterator_Destroy(objects);	count = OBJECT_STACK_SIZE;    }    for (i=0; i<count; i++) {	cbrv = (*callback)(tok, session, startOS[i], arg);    }    if (objectArena)	NSSArena_Destroy(objectArena);    return PR_SUCCESS;loser:    if (objectArena)	NSSArena_Destroy(objectArena);    return PR_FAILURE;}