IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6484 for trunk/psLib/src/types


Ignore:
Timestamp:
Feb 24, 2006, 1:43:16 PM (20 years ago)
Author:
drobbin
Message:

Changed psArray & psVector to zero 'n' upon allocation. Used to set vector->n = nalloc.

Location:
trunk/psLib/src/types
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psArray.c

    r6445 r6484  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-02-17 03:24:46 $
     11 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-02-24 23:43:15 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6464
    6565    P_PSARRAY_SET_NALLOC(psArr,nalloc);
    66     psArr->n = 0;
    67     //    psArr->n = nalloc;
     66    psArr->n = 0;  //set the initial number of elements in use to 0
    6867    // Create vector data array
    6968    psArr->data = psAlloc(nalloc * sizeof(psPtr));
     69    memset(psArr->data, 0, sizeof(void*) * nalloc);  //set the initial values of data to NULL
    7070
    7171    return psArr;
     
    8686        }
    8787        // Realloc after decrementation to avoid accessing freed array elements
     88        long n = in->n;
    8889        in->data = psRealloc(in->data, nalloc * sizeof(psPtr));
    8990        P_PSARRAY_SET_NALLOC(in,nalloc);
     91        for (long m = n; m < nalloc; m++) { //if array is grown, set grown data to NULL
     92            in->data[m] = NULL;
     93        }
    9094    }
    9195
  • trunk/psLib/src/types/psLookupTable.c

    r6445 r6484  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-02-17 03:24:46 $
     9*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-02-24 23:43:15 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    600600    // Check if array is sorted on the index column
    601601    psVector* sortedIndex = psVectorAlloc(numRows,PS_TYPE_U32);
     602    sortedIndex->n = numRows;
    602603    sortedIndex = psVectorSortIndex(sortedIndex,indexColumnVector);
    603604    for(psS32 i = 0; i < numRows; i++ ) {
     
    615616            psS32 type = ((psVector*)(vectors->data[j]))->type.type;
    616617            newValueArray->data[j] = psVectorAlloc(numRows,type);
     618            ((psVector*)(newValueArray->data[j]))->n = numRows;
    617619            newValueArray->n++;
    618620        }
  • trunk/psLib/src/types/psMetadataConfig.c

    r6191 r6484  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-01-25 22:33:41 $
     12*  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-02-24 23:43:15 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    363363                        elemType);
    364364            }
    365 
     365            vec->n++;
    366366            while(*end==' ' || *end==',') {
    367367                end++;
Note: See TracChangeset for help on using the changeset viewer.