IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 4, 2004, 1:37:39 PM (22 years ago)
Author:
desonia
Message:

found the server astyle upgrade was faulty, so the format was reset.

File:
1 edited

Legend:

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

    r1228 r1385  
    88 *  @author Ross Harman, MHPCC
    99 *
    10  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-07-15 22:18:02 $
     10 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-08-04 23:37:39 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767        psError(__func__, "Null input vector\n");
    6868        return NULL;
    69     } else if(in->nalloc != nalloc) {                    // No need to realloc to same size
    70         if(nalloc < in->n) {
    71             for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
    72                 psFree(in->data[i]);
     69    } else
     70        if(in->nalloc != nalloc) {                    // No need to realloc to same size
     71            if(nalloc < in->n) {
     72                for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
     73                    psFree(in->data[i]);
     74                }
     75                in->n = nalloc;
    7376            }
    74             in->n = nalloc;
     77
     78            // Realloc after decrementation to avoid accessing freed array elements
     79            in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
     80            in->nalloc = nalloc;
    7581        }
    76 
    77         // Realloc after decrementation to avoid accessing freed array elements
    78         in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
    79         in->nalloc = nalloc;
    80     }
    8182
    8283    return in;
Note: See TracChangeset for help on using the changeset viewer.