Index: trunk/psLib/test/collections/tst_psList.c
===================================================================
--- trunk/psLib/test/collections/tst_psList.c	(revision 2677)
+++ trunk/psLib/test/collections/tst_psList.c	(revision 2681)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-04 01:05:00 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-10 02:50:16 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -328,8 +328,7 @@
     psBool first = true;
 
-    psListSetIterator(list,PS_LIST_HEAD);
-    data = psListGetCurrent(list);
-
-    while ( data != NULL ) {
+    psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD);
+
+    while ( (data=(psS32*)psListGetNext(iter)) != NULL ) {
         if (!first) {
             printf(", %d",*(psS32*)data);
@@ -338,5 +337,4 @@
             first = false;
         }
-        data = psListGetNext(list);
     }
 
@@ -422,11 +420,4 @@
     }
 
-    //  5. which=PS_LIST_NEXT
-    data = (psS32*)psListGet(list,PS_LIST_NEXT);
-    if (data == NULL || *data != 1) {
-        psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=PS_LIST_NEXT");
-        return 7;
-    }
-
     //  6. which=PS_LIST_TAIL
     data = (psS32*)psListGet(list,PS_LIST_TAIL);
@@ -436,11 +427,4 @@
     }
 
-    //  7. which=PS_LIST_PREV
-    data = (psS32*)psListGet(list,PS_LIST_PREVIOUS);
-    if (data == NULL || *data != 2) {
-        psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=PS_LIST_PREV");
-        return 9;
-    }
-
     psFree(list);
 
@@ -452,4 +436,5 @@
     psList* list = NULL;
     psS32* data;
+    int items = 15;
 
     /*
@@ -472,5 +457,5 @@
     //  1. list is NULL.
     psLogMsg(__func__,PS_LOG_INFO,"Following should be an error");
-    if (psListRemove(list,PS_LIST_HEAD,NULL)) {
+    if (psListRemove(list,PS_LIST_HEAD)) {
         psError(PS_ERR_UNKNOWN, true,"psListRemove didn't return false given a NULL list.");
         return 1;
@@ -480,5 +465,5 @@
     list = psListAlloc(NULL);
 
-    for (psS32 lcv=0;lcv<15;lcv++) {
+    for (psS32 lcv=0;lcv<items;lcv++) {
         data = psAlloc(sizeof(psS32));
         *data = lcv;
@@ -490,5 +475,5 @@
     // 2. which is PS_LIST_HEAD (remove first element of list)
     data = psListGet(list,PS_LIST_HEAD);
-    if ( (! psListRemove(list,PS_LIST_HEAD,NULL)) ||
+    if ( (! psListRemove(list,PS_LIST_HEAD)) ||
             (psListGet(list,PS_LIST_HEAD) == data) ) {
         printListInt(list);
@@ -497,7 +482,7 @@
     }
 
-    if (list->size != 14) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 14.");
+    if (list->size != --items) {
+        printListInt(list);
+        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
         return 1;
     }
@@ -505,5 +490,5 @@
     // 3. which is PS_LIST_TAIL (remove last element of list)
     data = psListGet(list,PS_LIST_TAIL);
-    if ( (! psListRemove(list,PS_LIST_TAIL,NULL)) ||
+    if ( (! psListRemove(list,PS_LIST_TAIL)) ||
             (psListGet(list,PS_LIST_TAIL) == data) ) {
         printListInt(list);
@@ -512,89 +497,13 @@
     }
 
-    if (list->size != 13) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 13.");
-        return 1;
-    }
-
-    // 4. which is PS_LIST_NEXT (element right of cursor [which should be head,tail, and neither])
-    psListSetIterator(list,PS_LIST_HEAD);
-    if (! psListRemove(list,PS_LIST_NEXT,NULL)) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_NEXT @ PS_LIST_HEAD");
-        return 1;
-    }
-
-    if (list->size != 12) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 12.");
-        return 1;
-    }
-
-    psListSetIterator(list,PS_LIST_TAIL);
+    if (list->size != --items) {
+        printListInt(list);
+        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
+        return 1;
+    }
+
+    // 6. psListRemoveData where data=NULL (error)
     psLogMsg(__func__,PS_LOG_INFO,"Next message should be an error");
-    if (psListRemove(list,PS_LIST_NEXT,NULL)) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Removed something with PS_LIST_NEXT @ PS_LIST_TAIL");
-        return 1;
-    }
-
-    data = psListGet(list,3);
-    psListSetIterator(list,2);
-    if ( (!psListRemove(list,PS_LIST_NEXT,NULL)) ||
-            ( psListGet(list,3) == data) ) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_NEXT @ which=2");
-        return 1;
-    }
-
-    if (list->size != 11) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 11.");
-        return 1;
-    }
-
-    // 5. which is PS_LIST_PREV (element left of cursor [which should be head,tail, and neither])
-    psListSetIterator(list,PS_LIST_HEAD);
-    psLogMsg(__func__,PS_LOG_INFO,"Next message should be an error");
-    if (psListRemove(list,PS_LIST_PREVIOUS,NULL)) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"removed something for PS_LIST_PREVIOUS @ PS_LIST_HEAD");
-        return 1;
-    }
-
-    data = psListGet(list,9);
-    psListSetIterator(list,PS_LIST_TAIL);
-    if ( (!psListRemove(list,PS_LIST_PREVIOUS,NULL)) ||
-            (psListGet(list,9) == data) ) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_PREVIOUS @ PS_LIST_TAIL");
-        return 1;
-    }
-
-    if (list->size != 10) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 10.");
-        return 1;
-    }
-
-    data = psListGet(list,1);
-    psListSetIterator(list,2);
-    if ( (!psListRemove(list,PS_LIST_PREVIOUS,NULL)) ||
-            ( psListGet(list,1) == data) ) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_PREVIOUS @ which=2");
-        return 1;
-    }
-
-    if (list->size != 9) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 9.");
-        return 1;
-    }
-
-    // 6. which is PS_LIST_UNKNOWN and data=NULL (error)
-    psLogMsg(__func__,PS_LOG_INFO,"Next message should be an error");
-    if (psListRemove(list,PS_LIST_UNKNOWN,NULL)) {
+    if (psListRemoveData(list,NULL)) {
         printListInt(list);
         psError(PS_ERR_UNKNOWN, true,"removed something for PS_LIST_UNKNOWN with data=NULL");
@@ -604,5 +513,5 @@
     // 7. which is PS_LIST_UNKNOWN and data=[head,tail,other list items]
     data = psListGet(list,PS_LIST_HEAD);
-    if ( (! psListRemove(list,PS_LIST_UNKNOWN,data)) ||
+    if ( (! psListRemoveData(list,data)) ||
             (psListGet(list,PS_LIST_HEAD) == data) ) {
         printListInt(list);
@@ -611,12 +520,12 @@
     }
 
-    if (list->size != 8) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 8.");
+    if (list->size != --items) {
+        printListInt(list);
+        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
         return 1;
     }
 
     data = psListGet(list,PS_LIST_TAIL);
-    if ( (!psListRemove(list,PS_LIST_UNKNOWN,data)) ||
+    if ( (!psListRemoveData(list,data)) ||
             (psListGet(list,PS_LIST_TAIL) == data) ) {
         printListInt(list);
@@ -625,29 +534,27 @@
     }
 
-    if (list->size != 7) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 7.");
-        return 1;
-    }
-
-    psListSetIterator(list,PS_LIST_HEAD);
-
-    data = psListGet(list,PS_LIST_NEXT);
-    if ( (! psListRemove(list,PS_LIST_UNKNOWN,data))||
+    if (list->size != --items) {
+        printListInt(list);
+        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
+        return 1;
+    }
+
+    data = psListGet(list,1);
+    if ( (! psListRemoveData(list,data))||
             (psListGet(list,1) == data) ) {
         printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_UNKNOWN @ which=1");
-        return 1;
-    }
-
-    if (list->size != 6) {
-        printListInt(list);
-        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 6.");
-        return 1;
-    }
-
-    // 8. which is PS_LIST_UNKNOWN and data!=NULL and data!=any element in list
+        psError(PS_ERR_UNKNOWN, true,"Failed to remove data @ which=1");
+        return 1;
+    }
+
+    if (list->size != --items) {
+        printListInt(list);
+        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
+        return 1;
+    }
+
+    // 8. data!=NULL and data!=any element in list
     psLogMsg(__func__,PS_LOG_INFO,"Next message should be an error");
-    if ( psListRemove(list,PS_LIST_UNKNOWN,data) ) {
+    if ( psListRemoveData(list,data) ) {
         printListInt(list);
         psError(PS_ERR_UNKNOWN, true,"removed something for PS_LIST_UNKNOWN with previously removed item");
@@ -655,13 +562,18 @@
     }
 
+    if (list->size != items) {
+        printListInt(list);
+        psError(PS_ERR_UNKNOWN, true,"size not %d, as expected.",items);
+        return 1;
+    }
+
     // clear out the list
-    psListRemove(list,PS_LIST_HEAD,NULL);
-    psListRemove(list,PS_LIST_HEAD,NULL);
-    psListRemove(list,PS_LIST_HEAD,NULL);
-    psListRemove(list,PS_LIST_HEAD,NULL);
-    psListRemove(list,PS_LIST_HEAD,NULL);
+    while (items > 1) {
+        psListRemove(list,PS_LIST_HEAD);
+        items--;
+    }
 
     data = psListGet(list,PS_LIST_HEAD);
-    if ( (! psListRemove(list,PS_LIST_HEAD,data)) ||
+    if ( (! psListRemove(list,PS_LIST_HEAD)) ||
             (psListGet(list,PS_LIST_HEAD) == data) ) {
         printListInt(list);
@@ -844,13 +756,25 @@
     }
 
-
-    // 1. output error message and do nothing if list=NULL
+    psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD);
+    if (iter == NULL) {
+        psError(PS_ERR_UNKNOWN, true,"Failed to make an iterator.");
+        return 22;
+    }
+
+    // 1. output error message and do nothing if iterator=NULL
     psLogMsg(__func__,PS_LOG_INFO,"Following should error with "
              "'Unexpected null pointer'");
-    psListSetIterator(NULL,PS_LIST_HEAD);
+    psListIteratorSet(NULL,PS_LIST_HEAD);
+    if (psListIteratorSet(NULL,PS_LIST_HEAD)) {
+        psError(PS_ERR_UNKNOWN, true,"Success while setting position of a NULL iterator?");
+        return 23;
+    }
+
 
     // 3. set list.cursor to list.tail if where=PS_LIST_TAIL
-    psListSetIterator(list,PS_LIST_TAIL);
-    if (*(psS32*)psListGetCurrent(list) != 14) {
+
+    if (!psListIteratorSet(iter,PS_LIST_TAIL) ||
+            *(psS32*)iter->cursor->data != 14 ||
+            iter->index != 14) {
         psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to tail.");
         return 1;
@@ -858,78 +782,54 @@
 
     // 2. set list.cursor to list.head if where=PS_LIST_HEAD
-    psListSetIterator(list,PS_LIST_HEAD);
-    if (*(psS32*)psListGetCurrent(list) != 0) {
+    if (!psListIteratorSet(iter,PS_LIST_HEAD) ||
+            *(psS32*)iter->cursor->data != 0 ||
+            iter->index != 0) {
         psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to head.");
         return 2;
     }
 
-    // 4. set list.cursor to list.cursor->next if where=PS_LIST_NEXT
-    psListSetIterator(list,PS_LIST_NEXT);
-    if (*(psS32*)psListGetCurrent(list) != 1) {
-        psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to next.");
-        return 3;
-    }
-    psListSetIterator(list,PS_LIST_NEXT);
-    if (*(psS32*)psListGetCurrent(list) != 2) {
-        psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to next twice.");
-        return 4;
-    }
-
-    // 5. set list.cursor to list.cursor->prev if where=PS_LIST_PREV
-    psListSetIterator(list,PS_LIST_PREVIOUS);
-    if (*(psS32*)psListGetCurrent(list) != 1) {
-        psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to previous.");
-        return 5;
-    }
-    psListSetIterator(list,PS_LIST_PREVIOUS);
-    if (*(psS32*)psListGetCurrent(list) != 0) {
-        psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to previous twice.");
-        return 6;
-    }
-
-    // 6. leave list.cursor untouched if where=PS_LIST_UNKNOWN or PS_LIST_CURRENT
-    psListSetIterator(list,PS_LIST_NEXT);   // move off of head (works according to above)
-    psLogMsg(__func__,PS_LOG_INFO,"Following should error with 'Can't move to an unknown position.'");
-    psListSetIterator(list,PS_LIST_UNKNOWN);
-    if (*(psS32*)psListGetCurrent(list) != 1) {
-        psError(PS_ERR_UNKNOWN, true,"PS_LIST_UNKNOWN moved cursor.");
-        return 7;
-    }
-    psListSetIterator(list,PS_LIST_CURRENT);
-    if (*(psS32*)psListGetCurrent(list) != 1) {
-        psError(PS_ERR_UNKNOWN, true,"PS_LIST_CURRENT moved cursor.");
+    // test psListGetPrevious/Next
+    if (*(psS32*)psListGetNext(iter) != 0) {
+        psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next.");
         return 8;
     }
-
-    // test psListGetPrevious/Next
-    if (*(psS32*)psListGetNext(list) != 2) {
+    if (*(psS32*)psListGetNext(iter) != 1) {
         psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next.");
         return 9;
     }
-    if (*(psS32*)psListGetNext(list) != 3) {
+    if (*(psS32*)psListGetNext(iter) != 2) {
         psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next.");
         return 10;
     }
-    if (*(psS32*)psListGetPrevious(list) != 2) {
+
+    if (*(psS32*)psListGetPrevious(iter) != 3) {
         psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous.");
         return 11;
     }
-    if (*(psS32*)psListGetPrevious(list) != 1) {
+    if (*(psS32*)psListGetPrevious(iter) != 2) {
         psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous.");
         return 12;
     }
-    if (*(psS32*)psListGetPrevious(list) != 0) {
+    if (*(psS32*)psListGetPrevious(iter) != 1) {
         psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous..");
         return 13;
     }
-    if (psListGetPrevious(list) != NULL) {
+    if (*(psS32*)psListGetPrevious(iter) != 0) {
+        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous..");
+        return 14;
+    }
+    if (psListGetPrevious(iter) != NULL) {
         psError(PS_ERR_UNKNOWN, true,"psListGetPrevious moved cursor beyond head.");
-        return 14;
-    }
-
-    psListSetIterator(list,PS_LIST_TAIL); // works according to an above test
-    if (psListGetNext(list) != NULL) {
+        return 15;
+    }
+
+    psListIteratorSet(iter,PS_LIST_TAIL); // works according to an above test
+    if (*(psS32*)psListGetNext(iter) != 14) {
         psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail.");
-        return 15;
+        return 16;
+    }
+    if (psListGetNext(iter) != NULL) {
+        psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail.");
+        return 17;
     }
 
@@ -1001,4 +901,7 @@
 {
     psList* list;
+    psListIterator* iter;
+    float* fValue;
+    psU32* uValue;
 
     list = psListAlloc(NULL);
@@ -1017,8 +920,7 @@
 
     printf("original list = [");
-    for (float* iter = psListGet(list,PS_LIST_HEAD);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        printf(" %.1f",*iter);
+    iter = psListIteratorAlloc(list,PS_LIST_HEAD);
+    while( (fValue=psListGetNext(iter)) != NULL ) {
+        printf(" %.1f",*fValue);
     }
     printf(" ]\n");
@@ -1027,16 +929,14 @@
 
     printf("sorted list = [");
-    for (float* iter = psListGet(list,PS_LIST_HEAD);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        printf(" %.1f",*iter);
+    psListIteratorSet(iter,PS_LIST_HEAD);
+    while( (fValue=psListGetNext(iter)) != NULL ) {
+        printf(" %.1f",*fValue);
     }
     printf(" ]\n");
 
-    float* prevValue = psListGet(list,PS_LIST_HEAD);
-    for (float* iter = psListGet(list,PS_LIST_NEXT);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        if (*prevValue > *iter) {
+    psListIteratorSet(iter,PS_LIST_HEAD);
+    float* prevFValue = psListGetNext(iter);
+    while( (fValue=psListGetNext(iter)) != NULL ) {
+        if (*prevFValue > *fValue) {
             psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
             return 1;
@@ -1047,18 +947,16 @@
 
     printf("descending sort list = [");
-    for (float* iter = psListGet(list,PS_LIST_HEAD);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        printf(" %.1f",*iter);
+    psListIteratorSet(iter,PS_LIST_HEAD);
+    while( (fValue=psListGetNext(iter)) != NULL ) {
+        printf(" %.1f",*fValue);
     }
     printf(" ]\n");
 
-    prevValue = psListGet(list,PS_LIST_HEAD);
-    for (float* iter = psListGet(list,PS_LIST_NEXT);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        if (*prevValue < *iter) {
+    psListIteratorSet(iter,PS_LIST_HEAD);
+    prevFValue = psListGetNext(iter);
+    while( (fValue=psListGetNext(iter)) != NULL ) {
+        if (*prevFValue < *fValue) {
             psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
-            return 1;
+            return 2;
         }
     }
@@ -1083,8 +981,7 @@
 
     printf("original list = [");
-    for (psU32* iter = psListGet(list,PS_LIST_HEAD);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        printf(" %d",*iter);
+    psListIteratorSet(iter,PS_LIST_HEAD);
+    while( (uValue=psListGetNext(iter)) != NULL ) {
+        printf(" %d",*uValue);
     }
     printf(" ]\n");
@@ -1093,18 +990,16 @@
 
     printf("sorted list = [");
-    for (psU32* iter = psListGet(list,PS_LIST_HEAD);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        printf(" %d",*iter);
+    psListIteratorSet(iter,PS_LIST_HEAD);
+    while( (uValue=psListGetNext(iter)) != NULL ) {
+        printf(" %d",*uValue);
     }
     printf(" ]\n");
 
-    psU32* prev = psListGet(list,PS_LIST_HEAD);
-    for (psU32* iter = psListGet(list,PS_LIST_NEXT);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        if (*prev > *iter) {
+    psListIteratorSet(iter,PS_LIST_HEAD);
+    psU32* prevUValue = psListGetNext(iter);
+    while( (uValue=psListGetNext(iter)) != NULL ) {
+        if (*prevUValue < *uValue) {
             psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
-            return 1;
+            return 3;
         }
     }
@@ -1113,23 +1008,20 @@
 
     printf("descending sort list = [");
-    for (psU32* iter = psListGet(list,PS_LIST_HEAD);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        printf(" %d",*iter);
+    psListIteratorSet(iter,PS_LIST_HEAD);
+    while( (uValue=psListGetNext(iter)) != NULL ) {
+        printf(" %d",*uValue);
     }
     printf(" ]\n");
 
-    prev = psListGet(list,PS_LIST_HEAD);
-    for (psU32* iter = psListGet(list,PS_LIST_NEXT);
-            iter != NULL;
-            iter = psListGet(list,PS_LIST_NEXT)) {
-        if (*prev < *iter) {
+    psListIteratorSet(iter,PS_LIST_HEAD);
+    prevUValue = psListGetNext(iter);
+    while( (uValue=psListGetNext(iter)) != NULL ) {
+        if (*prevUValue < *uValue) {
             psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
-            return 1;
-        }
-    }
-
-    psFree(list);
-
+            return 4;
+        }
+    }
+
+    psFree(list);
 
     return 0;
Index: trunk/psLib/test/collections/tst_psMetadataIO.c
===================================================================
--- trunk/psLib/test/collections/tst_psMetadataIO.c	(revision 2677)
+++ trunk/psLib/test/collections/tst_psMetadataIO.c	(revision 2681)
@@ -13,6 +13,6 @@
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2004-12-03 23:19:07 $
+*  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2004-12-10 02:50:15 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -41,10 +41,11 @@
     psMetadataItem *entryChild = NULL;
 
-    psListSetIterator(metadataItemList, PS_LIST_HEAD);
-    entryChild = psListGetCurrent(metadataItemList);
-    while (entryChild != NULL) {
+    psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD);
+
+    while ( (entryChild=psListGetNext(iter)) != NULL) {
         printMetadataItem(entryChild, spaces);
-        entryChild = psListGetNext(metadataItemList);
     }
+
+    psFree(iter);
 }
 
Index: trunk/psLib/test/collections/tst_psMetadata_01.c
===================================================================
--- trunk/psLib/test/collections/tst_psMetadata_01.c	(revision 2677)
+++ trunk/psLib/test/collections/tst_psMetadata_01.c	(revision 2681)
@@ -18,6 +18,6 @@
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.16 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2004-12-03 23:19:07 $
+*  @version $Revision: 1.17 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2004-12-10 02:50:15 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -46,10 +46,12 @@
     psMetadataItem *entryChild = NULL;
 
-    psListSetIterator(metadataItemList, PS_LIST_HEAD);
-    entryChild = psListGetCurrent(metadataItemList);
-    while (entryChild != NULL) {
+    psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD);
+
+    while ( (entryChild=psListGetNext(iter)) != NULL) {
         printMetadataItem(entryChild, spaces);
-        entryChild = psListGetNext(metadataItemList);
-    }
+    }
+
+    psFree(iter);
+
 }
 
