Index: mozilla/security/nss/lib/pk11wrap/pk11obj.c =================================================================== RCS file: /cvsroot/mozilla/security/nss/lib/pk11wrap/pk11obj.c,v retrieving revision 1.13 diff -u -r1.13 mozilla/security/nss/lib/pk11wrap/pk11obj.c --- mozilla/security/nss/lib/pk11wrap/pk11obj.c +++ mozilla/security/nss/lib/pk11wrap/pk11obj.c @@ -1133,37 +1133,50 @@ return SECSuccess; } +#if 0 /* - * return a linked, non-circular list of generic objects. + * Sample code relating to linked list returned by PK11_FindGenericObjects + */ + +/* + * You can walk the list with the following code: + */ + firstObj = PK11_FindGenericObjects(slot, objClass); + for (thisObj=firstObj; + thisObj; + thisObj=PK11_GetNextGenericObject(thisObj)) { + /* operate on thisObj */ + } +/* + * If you want a particular object from the list... + */ + firstObj = PK11_FindGenericObjects(slot, objClass); + for (thisObj=firstObj; + thisObj; + thisObj=PK11_GetNextGenericObject(thisObj)) { + if (isMyObj(thisObj)) { + if ( thisObj == firstObj) { + /* NOTE: firstObj could be NULL at this point */ + firstObj = PK11_GetNextGenericObject(thsObj); + } + PK11_UnlinkGenericObject(thisObj); + myObj = thisObj; + break; + } + } + + PK11_DestroyGenericObjects(firstObj); + + /* use myObj */ + + PK11_DestroyGenericObject(myObj); +#endif /* sample code */ + +/* + * return a linked, non-circular list of generic objects. * If you are only interested * in one object, just use the first object in the list. To find the * rest of the list use PK11_GetNextGenericObject() to return the next object. - * - * You can walk the list with the following code: - * firstObj = PK11_FindGenericObjects(slot, objClass); - * for (thisObj=firstObj; thisObj; - * thisObj=PK11_GetNextGenericObject(thisObj)) { - * /* operate on thisObj */ -/* } - * - * If you want a particular object from the list... - * firstObj = PK11_FindGenericObjects(slot, objClass); - * for (thisObj=firstObj; thisObj; - * thisObj=PK11_GetNextGenericObject(thisObj)) { - * if (isMyObj(thisObj)) { - * if ( thisObj == firstObj) { - * /* NOTE: firstObj could be NULL at this point */ -/* firstObj = PK11_GetNextGenericObject(thsObj); - * } - * PK11_UnlinkGenericObject(thisObj); - * myObj = thisObj; - * break; - * } - * - * PK11_DestroyGenericObjects(firstObj); - * - * /* use myObj */ -/* PK11_DestroyGenericObject(myObj); */ PK11GenericObject * PK11_FindGenericObjects(PK11SlotInfo *slot, CK_OBJECT_CLASS objClass)