IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 15, 2004, 12:18:02 PM (22 years ago)
Author:
desonia
Message:

extracted the vector of pointers functionality to a new object, psArray.

File:
1 edited

Legend:

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

    r1103 r1228  
    88 *  @author Ross Harman, MHPCC
    99 *
    10  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-06-26 00:24:30 $
     10 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-07-15 22:18:02 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    100100        elementSize = PSELEMTYPE_SIZEOF(elemType);
    101101        if(nalloc < in->n) {
    102             if (elemType == PS_TYPE_PTR) {
    103                 for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
    104                     psMemDecrRefCounter(in->data.PTR[i]);
    105                 }
    106             }
    107102            in->n = nalloc;
    108103        }
     
    139134
    140135
    141     // if vector of pointers, dereference old values.
    142     if (elemType == PS_TYPE_PTR) {
    143         for (int i = 0; i < in->n; i++) {   // For reduction in vector size
    144             psMemDecrRefCounter(in->data.PTR[i]);
    145             in->data.PTR[i] = NULL;
    146         }
    147     }
    148 
    149136    in->data.V = psRealloc(in->data.V,nalloc*PSELEMTYPE_SIZEOF(type));
    150137
     
    162149    }
    163150
    164     if (psVec->type.type == PS_TYPE_PTR) {
    165         for(int i = 0; i < psVec->n; i++) {
    166             psFree(psVec->data.PTR[i]);
    167             psVec->data.PTR[i] = NULL;
    168         }
    169     }
    170 
    171151    psFree(psVec->data.V);
    172152}
    173 
    174 void psVectorElementFree(psVector *restrict psVec)
    175 {
    176 
    177     if(psVec == NULL) {
    178         return;
    179     }
    180 
    181     if (psVec->type.type != PS_TYPE_PTR) {
    182         psLogMsg(__func__,PS_LOG_WARN,"psVectorElementFree only operates on void* vectors");
    183         return;
    184     }
    185 
    186     for(int i = 0; i < psVec->n; i++) {
    187         psFree(psVec->data.PTR[i]);
    188         psVec->data.PTR[i] = NULL;
    189     }
    190 }
    191 
Note: See TracChangeset for help on using the changeset viewer.