IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 9, 2004, 4:50:16 PM (22 years ago)
Author:
desonia
Message:

Changed psList API for iterators, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/collections/tst_psList.c

    r2273 r2681  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-11-04 01:05:00 $
     8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-12-10 02:50:16 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    328328    psBool first = true;
    329329
    330     psListSetIterator(list,PS_LIST_HEAD);
    331     data = psListGetCurrent(list);
    332 
    333     while ( data != NULL ) {
     330    psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD);
     331
     332    while ( (data=(psS32*)psListGetNext(iter)) != NULL ) {
    334333        if (!first) {
    335334            printf(", %d",*(psS32*)data);
     
    338337            first = false;
    339338        }
    340         data = psListGetNext(list);
    341339    }
    342340
     
    422420    }
    423421
    424     //  5. which=PS_LIST_NEXT
    425     data = (psS32*)psListGet(list,PS_LIST_NEXT);
    426     if (data == NULL || *data != 1) {
    427         psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=PS_LIST_NEXT");
    428         return 7;
    429     }
    430 
    431422    //  6. which=PS_LIST_TAIL
    432423    data = (psS32*)psListGet(list,PS_LIST_TAIL);
     
    436427    }
    437428
    438     //  7. which=PS_LIST_PREV
    439     data = (psS32*)psListGet(list,PS_LIST_PREVIOUS);
    440     if (data == NULL || *data != 2) {
    441         psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=PS_LIST_PREV");
    442         return 9;
    443     }
    444 
    445429    psFree(list);
    446430
     
    452436    psList* list = NULL;
    453437    psS32* data;
     438    int items = 15;
    454439
    455440    /*
     
    472457    //  1. list is NULL.
    473458    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error");
    474     if (psListRemove(list,PS_LIST_HEAD,NULL)) {
     459    if (psListRemove(list,PS_LIST_HEAD)) {
    475460        psError(PS_ERR_UNKNOWN, true,"psListRemove didn't return false given a NULL list.");
    476461        return 1;
     
    480465    list = psListAlloc(NULL);
    481466
    482     for (psS32 lcv=0;lcv<15;lcv++) {
     467    for (psS32 lcv=0;lcv<items;lcv++) {
    483468        data = psAlloc(sizeof(psS32));
    484469        *data = lcv;
     
    490475    // 2. which is PS_LIST_HEAD (remove first element of list)
    491476    data = psListGet(list,PS_LIST_HEAD);
    492     if ( (! psListRemove(list,PS_LIST_HEAD,NULL)) ||
     477    if ( (! psListRemove(list,PS_LIST_HEAD)) ||
    493478            (psListGet(list,PS_LIST_HEAD) == data) ) {
    494479        printListInt(list);
     
    497482    }
    498483
    499     if (list->size != 14) {
    500         printListInt(list);
    501         psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 14.");
     484    if (list->size != --items) {
     485        printListInt(list);
     486        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
    502487        return 1;
    503488    }
     
    505490    // 3. which is PS_LIST_TAIL (remove last element of list)
    506491    data = psListGet(list,PS_LIST_TAIL);
    507     if ( (! psListRemove(list,PS_LIST_TAIL,NULL)) ||
     492    if ( (! psListRemove(list,PS_LIST_TAIL)) ||
    508493            (psListGet(list,PS_LIST_TAIL) == data) ) {
    509494        printListInt(list);
     
    512497    }
    513498
    514     if (list->size != 13) {
    515         printListInt(list);
    516         psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 13.");
    517         return 1;
    518     }
    519 
    520     // 4. which is PS_LIST_NEXT (element right of cursor [which should be head,tail, and neither])
    521     psListSetIterator(list,PS_LIST_HEAD);
    522     if (! psListRemove(list,PS_LIST_NEXT,NULL)) {
    523         printListInt(list);
    524         psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_NEXT @ PS_LIST_HEAD");
    525         return 1;
    526     }
    527 
    528     if (list->size != 12) {
    529         printListInt(list);
    530         psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 12.");
    531         return 1;
    532     }
    533 
    534     psListSetIterator(list,PS_LIST_TAIL);
     499    if (list->size != --items) {
     500        printListInt(list);
     501        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
     502        return 1;
     503    }
     504
     505    // 6. psListRemoveData where data=NULL (error)
    535506    psLogMsg(__func__,PS_LOG_INFO,"Next message should be an error");
    536     if (psListRemove(list,PS_LIST_NEXT,NULL)) {
    537         printListInt(list);
    538         psError(PS_ERR_UNKNOWN, true,"Removed something with PS_LIST_NEXT @ PS_LIST_TAIL");
    539         return 1;
    540     }
    541 
    542     data = psListGet(list,3);
    543     psListSetIterator(list,2);
    544     if ( (!psListRemove(list,PS_LIST_NEXT,NULL)) ||
    545             ( psListGet(list,3) == data) ) {
    546         printListInt(list);
    547         psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_NEXT @ which=2");
    548         return 1;
    549     }
    550 
    551     if (list->size != 11) {
    552         printListInt(list);
    553         psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 11.");
    554         return 1;
    555     }
    556 
    557     // 5. which is PS_LIST_PREV (element left of cursor [which should be head,tail, and neither])
    558     psListSetIterator(list,PS_LIST_HEAD);
    559     psLogMsg(__func__,PS_LOG_INFO,"Next message should be an error");
    560     if (psListRemove(list,PS_LIST_PREVIOUS,NULL)) {
    561         printListInt(list);
    562         psError(PS_ERR_UNKNOWN, true,"removed something for PS_LIST_PREVIOUS @ PS_LIST_HEAD");
    563         return 1;
    564     }
    565 
    566     data = psListGet(list,9);
    567     psListSetIterator(list,PS_LIST_TAIL);
    568     if ( (!psListRemove(list,PS_LIST_PREVIOUS,NULL)) ||
    569             (psListGet(list,9) == data) ) {
    570         printListInt(list);
    571         psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_PREVIOUS @ PS_LIST_TAIL");
    572         return 1;
    573     }
    574 
    575     if (list->size != 10) {
    576         printListInt(list);
    577         psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 10.");
    578         return 1;
    579     }
    580 
    581     data = psListGet(list,1);
    582     psListSetIterator(list,2);
    583     if ( (!psListRemove(list,PS_LIST_PREVIOUS,NULL)) ||
    584             ( psListGet(list,1) == data) ) {
    585         printListInt(list);
    586         psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_PREVIOUS @ which=2");
    587         return 1;
    588     }
    589 
    590     if (list->size != 9) {
    591         printListInt(list);
    592         psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 9.");
    593         return 1;
    594     }
    595 
    596     // 6. which is PS_LIST_UNKNOWN and data=NULL (error)
    597     psLogMsg(__func__,PS_LOG_INFO,"Next message should be an error");
    598     if (psListRemove(list,PS_LIST_UNKNOWN,NULL)) {
     507    if (psListRemoveData(list,NULL)) {
    599508        printListInt(list);
    600509        psError(PS_ERR_UNKNOWN, true,"removed something for PS_LIST_UNKNOWN with data=NULL");
     
    604513    // 7. which is PS_LIST_UNKNOWN and data=[head,tail,other list items]
    605514    data = psListGet(list,PS_LIST_HEAD);
    606     if ( (! psListRemove(list,PS_LIST_UNKNOWN,data)) ||
     515    if ( (! psListRemoveData(list,data)) ||
    607516            (psListGet(list,PS_LIST_HEAD) == data) ) {
    608517        printListInt(list);
     
    611520    }
    612521
    613     if (list->size != 8) {
    614         printListInt(list);
    615         psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 8.");
     522    if (list->size != --items) {
     523        printListInt(list);
     524        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
    616525        return 1;
    617526    }
    618527
    619528    data = psListGet(list,PS_LIST_TAIL);
    620     if ( (!psListRemove(list,PS_LIST_UNKNOWN,data)) ||
     529    if ( (!psListRemoveData(list,data)) ||
    621530            (psListGet(list,PS_LIST_TAIL) == data) ) {
    622531        printListInt(list);
     
    625534    }
    626535
    627     if (list->size != 7) {
    628         printListInt(list);
    629         psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 7.");
    630         return 1;
    631     }
    632 
    633     psListSetIterator(list,PS_LIST_HEAD);
    634 
    635     data = psListGet(list,PS_LIST_NEXT);
    636     if ( (! psListRemove(list,PS_LIST_UNKNOWN,data))||
     536    if (list->size != --items) {
     537        printListInt(list);
     538        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
     539        return 1;
     540    }
     541
     542    data = psListGet(list,1);
     543    if ( (! psListRemoveData(list,data))||
    637544            (psListGet(list,1) == data) ) {
    638545        printListInt(list);
    639         psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_UNKNOWN @ which=1");
    640         return 1;
    641     }
    642 
    643     if (list->size != 6) {
    644         printListInt(list);
    645         psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 6.");
    646         return 1;
    647     }
    648 
    649     // 8. which is PS_LIST_UNKNOWN and data!=NULL and data!=any element in list
     546        psError(PS_ERR_UNKNOWN, true,"Failed to remove data @ which=1");
     547        return 1;
     548    }
     549
     550    if (list->size != --items) {
     551        printListInt(list);
     552        psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to %d.",items);
     553        return 1;
     554    }
     555
     556    // 8. data!=NULL and data!=any element in list
    650557    psLogMsg(__func__,PS_LOG_INFO,"Next message should be an error");
    651     if ( psListRemove(list,PS_LIST_UNKNOWN,data) ) {
     558    if ( psListRemoveData(list,data) ) {
    652559        printListInt(list);
    653560        psError(PS_ERR_UNKNOWN, true,"removed something for PS_LIST_UNKNOWN with previously removed item");
     
    655562    }
    656563
     564    if (list->size != items) {
     565        printListInt(list);
     566        psError(PS_ERR_UNKNOWN, true,"size not %d, as expected.",items);
     567        return 1;
     568    }
     569
    657570    // clear out the list
    658     psListRemove(list,PS_LIST_HEAD,NULL);
    659     psListRemove(list,PS_LIST_HEAD,NULL);
    660     psListRemove(list,PS_LIST_HEAD,NULL);
    661     psListRemove(list,PS_LIST_HEAD,NULL);
    662     psListRemove(list,PS_LIST_HEAD,NULL);
     571    while (items > 1) {
     572        psListRemove(list,PS_LIST_HEAD);
     573        items--;
     574    }
    663575
    664576    data = psListGet(list,PS_LIST_HEAD);
    665     if ( (! psListRemove(list,PS_LIST_HEAD,data)) ||
     577    if ( (! psListRemove(list,PS_LIST_HEAD)) ||
    666578            (psListGet(list,PS_LIST_HEAD) == data) ) {
    667579        printListInt(list);
     
    844756    }
    845757
    846 
    847     // 1. output error message and do nothing if list=NULL
     758    psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD);
     759    if (iter == NULL) {
     760        psError(PS_ERR_UNKNOWN, true,"Failed to make an iterator.");
     761        return 22;
     762    }
     763
     764    // 1. output error message and do nothing if iterator=NULL
    848765    psLogMsg(__func__,PS_LOG_INFO,"Following should error with "
    849766             "'Unexpected null pointer'");
    850     psListSetIterator(NULL,PS_LIST_HEAD);
     767    psListIteratorSet(NULL,PS_LIST_HEAD);
     768    if (psListIteratorSet(NULL,PS_LIST_HEAD)) {
     769        psError(PS_ERR_UNKNOWN, true,"Success while setting position of a NULL iterator?");
     770        return 23;
     771    }
     772
    851773
    852774    // 3. set list.cursor to list.tail if where=PS_LIST_TAIL
    853     psListSetIterator(list,PS_LIST_TAIL);
    854     if (*(psS32*)psListGetCurrent(list) != 14) {
     775
     776    if (!psListIteratorSet(iter,PS_LIST_TAIL) ||
     777            *(psS32*)iter->cursor->data != 14 ||
     778            iter->index != 14) {
    855779        psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to tail.");
    856780        return 1;
     
    858782
    859783    // 2. set list.cursor to list.head if where=PS_LIST_HEAD
    860     psListSetIterator(list,PS_LIST_HEAD);
    861     if (*(psS32*)psListGetCurrent(list) != 0) {
     784    if (!psListIteratorSet(iter,PS_LIST_HEAD) ||
     785            *(psS32*)iter->cursor->data != 0 ||
     786            iter->index != 0) {
    862787        psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to head.");
    863788        return 2;
    864789    }
    865790
    866     // 4. set list.cursor to list.cursor->next if where=PS_LIST_NEXT
    867     psListSetIterator(list,PS_LIST_NEXT);
    868     if (*(psS32*)psListGetCurrent(list) != 1) {
    869         psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to next.");
    870         return 3;
    871     }
    872     psListSetIterator(list,PS_LIST_NEXT);
    873     if (*(psS32*)psListGetCurrent(list) != 2) {
    874         psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to next twice.");
    875         return 4;
    876     }
    877 
    878     // 5. set list.cursor to list.cursor->prev if where=PS_LIST_PREV
    879     psListSetIterator(list,PS_LIST_PREVIOUS);
    880     if (*(psS32*)psListGetCurrent(list) != 1) {
    881         psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to previous.");
    882         return 5;
    883     }
    884     psListSetIterator(list,PS_LIST_PREVIOUS);
    885     if (*(psS32*)psListGetCurrent(list) != 0) {
    886         psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to previous twice.");
    887         return 6;
    888     }
    889 
    890     // 6. leave list.cursor untouched if where=PS_LIST_UNKNOWN or PS_LIST_CURRENT
    891     psListSetIterator(list,PS_LIST_NEXT);   // move off of head (works according to above)
    892     psLogMsg(__func__,PS_LOG_INFO,"Following should error with 'Can't move to an unknown position.'");
    893     psListSetIterator(list,PS_LIST_UNKNOWN);
    894     if (*(psS32*)psListGetCurrent(list) != 1) {
    895         psError(PS_ERR_UNKNOWN, true,"PS_LIST_UNKNOWN moved cursor.");
    896         return 7;
    897     }
    898     psListSetIterator(list,PS_LIST_CURRENT);
    899     if (*(psS32*)psListGetCurrent(list) != 1) {
    900         psError(PS_ERR_UNKNOWN, true,"PS_LIST_CURRENT moved cursor.");
     791    // test psListGetPrevious/Next
     792    if (*(psS32*)psListGetNext(iter) != 0) {
     793        psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next.");
    901794        return 8;
    902795    }
    903 
    904     // test psListGetPrevious/Next
    905     if (*(psS32*)psListGetNext(list) != 2) {
     796    if (*(psS32*)psListGetNext(iter) != 1) {
    906797        psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next.");
    907798        return 9;
    908799    }
    909     if (*(psS32*)psListGetNext(list) != 3) {
     800    if (*(psS32*)psListGetNext(iter) != 2) {
    910801        psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next.");
    911802        return 10;
    912803    }
    913     if (*(psS32*)psListGetPrevious(list) != 2) {
     804
     805    if (*(psS32*)psListGetPrevious(iter) != 3) {
    914806        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous.");
    915807        return 11;
    916808    }
    917     if (*(psS32*)psListGetPrevious(list) != 1) {
     809    if (*(psS32*)psListGetPrevious(iter) != 2) {
    918810        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous.");
    919811        return 12;
    920812    }
    921     if (*(psS32*)psListGetPrevious(list) != 0) {
     813    if (*(psS32*)psListGetPrevious(iter) != 1) {
    922814        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous..");
    923815        return 13;
    924816    }
    925     if (psListGetPrevious(list) != NULL) {
     817    if (*(psS32*)psListGetPrevious(iter) != 0) {
     818        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous..");
     819        return 14;
     820    }
     821    if (psListGetPrevious(iter) != NULL) {
    926822        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious moved cursor beyond head.");
    927         return 14;
    928     }
    929 
    930     psListSetIterator(list,PS_LIST_TAIL); // works according to an above test
    931     if (psListGetNext(list) != NULL) {
     823        return 15;
     824    }
     825
     826    psListIteratorSet(iter,PS_LIST_TAIL); // works according to an above test
     827    if (*(psS32*)psListGetNext(iter) != 14) {
    932828        psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail.");
    933         return 15;
     829        return 16;
     830    }
     831    if (psListGetNext(iter) != NULL) {
     832        psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail.");
     833        return 17;
    934834    }
    935835
     
    1001901{
    1002902    psList* list;
     903    psListIterator* iter;
     904    float* fValue;
     905    psU32* uValue;
    1003906
    1004907    list = psListAlloc(NULL);
     
    1017920
    1018921    printf("original list = [");
    1019     for (float* iter = psListGet(list,PS_LIST_HEAD);
    1020             iter != NULL;
    1021             iter = psListGet(list,PS_LIST_NEXT)) {
    1022         printf(" %.1f",*iter);
     922    iter = psListIteratorAlloc(list,PS_LIST_HEAD);
     923    while( (fValue=psListGetNext(iter)) != NULL ) {
     924        printf(" %.1f",*fValue);
    1023925    }
    1024926    printf(" ]\n");
     
    1027929
    1028930    printf("sorted list = [");
    1029     for (float* iter = psListGet(list,PS_LIST_HEAD);
    1030             iter != NULL;
    1031             iter = psListGet(list,PS_LIST_NEXT)) {
    1032         printf(" %.1f",*iter);
     931    psListIteratorSet(iter,PS_LIST_HEAD);
     932    while( (fValue=psListGetNext(iter)) != NULL ) {
     933        printf(" %.1f",*fValue);
    1033934    }
    1034935    printf(" ]\n");
    1035936
    1036     float* prevValue = psListGet(list,PS_LIST_HEAD);
    1037     for (float* iter = psListGet(list,PS_LIST_NEXT);
    1038             iter != NULL;
    1039             iter = psListGet(list,PS_LIST_NEXT)) {
    1040         if (*prevValue > *iter) {
     937    psListIteratorSet(iter,PS_LIST_HEAD);
     938    float* prevFValue = psListGetNext(iter);
     939    while( (fValue=psListGetNext(iter)) != NULL ) {
     940        if (*prevFValue > *fValue) {
    1041941            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
    1042942            return 1;
     
    1047947
    1048948    printf("descending sort list = [");
    1049     for (float* iter = psListGet(list,PS_LIST_HEAD);
    1050             iter != NULL;
    1051             iter = psListGet(list,PS_LIST_NEXT)) {
    1052         printf(" %.1f",*iter);
     949    psListIteratorSet(iter,PS_LIST_HEAD);
     950    while( (fValue=psListGetNext(iter)) != NULL ) {
     951        printf(" %.1f",*fValue);
    1053952    }
    1054953    printf(" ]\n");
    1055954
    1056     prevValue = psListGet(list,PS_LIST_HEAD);
    1057     for (float* iter = psListGet(list,PS_LIST_NEXT);
    1058             iter != NULL;
    1059             iter = psListGet(list,PS_LIST_NEXT)) {
    1060         if (*prevValue < *iter) {
     955    psListIteratorSet(iter,PS_LIST_HEAD);
     956    prevFValue = psListGetNext(iter);
     957    while( (fValue=psListGetNext(iter)) != NULL ) {
     958        if (*prevFValue < *fValue) {
    1061959            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
    1062             return 1;
     960            return 2;
    1063961        }
    1064962    }
     
    1083981
    1084982    printf("original list = [");
    1085     for (psU32* iter = psListGet(list,PS_LIST_HEAD);
    1086             iter != NULL;
    1087             iter = psListGet(list,PS_LIST_NEXT)) {
    1088         printf(" %d",*iter);
     983    psListIteratorSet(iter,PS_LIST_HEAD);
     984    while( (uValue=psListGetNext(iter)) != NULL ) {
     985        printf(" %d",*uValue);
    1089986    }
    1090987    printf(" ]\n");
     
    1093990
    1094991    printf("sorted list = [");
    1095     for (psU32* iter = psListGet(list,PS_LIST_HEAD);
    1096             iter != NULL;
    1097             iter = psListGet(list,PS_LIST_NEXT)) {
    1098         printf(" %d",*iter);
     992    psListIteratorSet(iter,PS_LIST_HEAD);
     993    while( (uValue=psListGetNext(iter)) != NULL ) {
     994        printf(" %d",*uValue);
    1099995    }
    1100996    printf(" ]\n");
    1101997
    1102     psU32* prev = psListGet(list,PS_LIST_HEAD);
    1103     for (psU32* iter = psListGet(list,PS_LIST_NEXT);
    1104             iter != NULL;
    1105             iter = psListGet(list,PS_LIST_NEXT)) {
    1106         if (*prev > *iter) {
     998    psListIteratorSet(iter,PS_LIST_HEAD);
     999    psU32* prevUValue = psListGetNext(iter);
     1000    while( (uValue=psListGetNext(iter)) != NULL ) {
     1001        if (*prevUValue < *uValue) {
    11071002            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
    1108             return 1;
     1003            return 3;
    11091004        }
    11101005    }
     
    11131008
    11141009    printf("descending sort list = [");
    1115     for (psU32* iter = psListGet(list,PS_LIST_HEAD);
    1116             iter != NULL;
    1117             iter = psListGet(list,PS_LIST_NEXT)) {
    1118         printf(" %d",*iter);
     1010    psListIteratorSet(iter,PS_LIST_HEAD);
     1011    while( (uValue=psListGetNext(iter)) != NULL ) {
     1012        printf(" %d",*uValue);
    11191013    }
    11201014    printf(" ]\n");
    11211015
    1122     prev = psListGet(list,PS_LIST_HEAD);
    1123     for (psU32* iter = psListGet(list,PS_LIST_NEXT);
    1124             iter != NULL;
    1125             iter = psListGet(list,PS_LIST_NEXT)) {
    1126         if (*prev < *iter) {
     1016    psListIteratorSet(iter,PS_LIST_HEAD);
     1017    prevUValue = psListGetNext(iter);
     1018    while( (uValue=psListGetNext(iter)) != NULL ) {
     1019        if (*prevUValue < *uValue) {
    11271020            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
    1128             return 1;
    1129         }
    1130     }
    1131 
    1132     psFree(list);
    1133 
     1021            return 4;
     1022        }
     1023    }
     1024
     1025    psFree(list);
    11341026
    11351027    return 0;
Note: See TracChangeset for help on using the changeset viewer.