IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 5, 2005, 5:04:35 PM (21 years ago)
Author:
drobbin
Message:

made changes based on revisions in psLib SDRS rev. 15

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psList.c

    r4392 r4457  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-06-25 02:02:05 $
     8 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-07-06 03:04:35 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    113113    }
    114114
    115     list->size--;
     115    list->n--;
    116116
    117117    pthread_mutex_unlock(&list->lock)
     
    131131    psMemSetDeallocator(list, (psFreeFunc) listFree);
    132132
    133     list->size = 0;
     133    list->n = 0;
    134134    list->head = list->tail = NULL;
    135135    list->iterators = psArrayAlloc(16);
     
    182182
    183183bool psListIteratorSet(psListIterator* iterator,
    184                        int location)
     184                       long location)
    185185{
    186186    if (iterator == NULL) {
     
    192192    if (location == PS_LIST_TAIL) {
    193193        iterator->cursor = list->tail;
    194         iterator->index = list->size - 1;
     194        iterator->index = list->n - 1;
    195195        iterator->offEnd = false;
    196196        return true;
     
    205205
    206206    if (location < 0) {
    207         location = list->size + location;
    208     }
    209 
    210     if (location < 0 || location >= (int)list->size) {
     207        location = list->n + location;
     208    }
     209
     210    if (location < 0 || location >= (int)list->n) {
    211211        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    212212                PS_ERRORTEXT_psList_LOCATION_INVALID,
     
    218218    int index = iterator->index;
    219219    if (cursor == NULL) {      // set the cursor to the head if it is NULL
    220         if (location > list->size/2) { // closer to tail or head?
     220        if (location > list->n/2) { // closer to tail or head?
    221221            cursor = list->tail;
    222             index = list->size - 1;
     222            index = list->n - 1;
    223223        } else {
    224224            cursor = list->head;
     
    262262    }
    263263
    264     if (location > 0 && location >= (int)list->size) {
     264    if (location > 0 && location >= (int)list->n) {
    265265        psLogMsg(__func__,PS_LOG_WARN,
    266266                 "Specified location, %d, is beyond the end of the list.  "
     
    337337    elem->data = psMemIncrRefCounter(data);
    338338
    339     list->size++;
     339    list->n++;
    340340
    341341    if (cursor == list->tail) {
     
    412412    elem->data = psMemIncrRefCounter(data);
    413413
    414     list->size++;
     414    list->n++;
    415415
    416416    if (cursor == list->head) {
     
    548548    if ( (iterator->cursor == NULL) && (iterator->offEnd) ) {
    549549        iterator->cursor = iterator->list->tail;
    550         iterator->index = iterator->list->size-1;
     550        iterator->index = iterator->list->n-1;
    551551        iterator->offEnd = false;
    552552        return NULL;
     
    574574    }
    575575
    576     if (list->size > 0) {
    577         arr = psArrayAlloc(list->size);
     576    if (list->n > 0) {
     577        arr = psArrayAlloc(list->n);
    578578    } else {
    579579        arr = psArrayAlloc(1);
    580580    }
    581581
    582     arr->n = list->size;
     582    arr->n = list->n;
    583583
    584584    ptr = list->head;
    585     n = list->size;
     585    n = list->n;
    586586    for (psS32 i = 0; i < n; i++) {
    587587        arr->data[i] = psMemIncrRefCounter(ptr->data);
Note: See TracChangeset for help on using the changeset viewer.