IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1073


Ignore:
Timestamp:
Jun 23, 2004, 1:00:17 PM (22 years ago)
Author:
desonia
Message:

Changed the means of deallocation of memory. ps_Alloc now registers an optional free function to handle any additional processing of a memory object.

Location:
trunk/psLib
Files:
136 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/psLib.kdevelop

    r667 r1073  
    136136      <hidepatterns>*.o,*.lo,CVS</hidepatterns>
    137137      <hidenonprojectfiles>false</hidenonprojectfiles>
     138      <showvcsfields>false</showvcsfields>
    138139    </tree>
    139140  </kdevfileview>
     
    144145    </filetemplates>
    145146  </cppsupportpart>
     147  <kdevcvsservice>
     148    <recursivewhenupdate>true</recursivewhenupdate>
     149    <prunedirswhenupdate>true</prunedirswhenupdate>
     150    <createdirswhenupdate>true</createdirswhenupdate>
     151    <recursivewhencommitremove>true</recursivewhencommitremove>
     152    <revertoptions>-C</revertoptions>
     153  </kdevcvsservice>
    146154</kdevelop>
  • trunk/psLib/psLib.kdevses

    r1005 r1073  
    22<!DOCTYPE KDevPrjSession>
    33<KDevPrjSession>
    4  <DocsAndViews NumberOfDocuments="0" />
     4 <DocsAndViews NumberOfDocuments="11" >
     5  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psImage.c" >
     6   <View0 line="0" Type="???" >
     7    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="861" Left="1" MinMaxMode="0" />
     8   </View0>
     9  </Doc0>
     10  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psBitSet.c" >
     11   <View0 line="107" Type="???" >
     12    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="832" Left="1" MinMaxMode="0" />
     13   </View0>
     14  </Doc1>
     15  <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psList.c" >
     16   <View0 line="43" Type="???" >
     17    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="832" Left="1" MinMaxMode="0" />
     18   </View0>
     19  </Doc2>
     20  <Doc3 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psVector.c" >
     21   <View0 line="185" Type="???" >
     22    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="832" Left="1" MinMaxMode="0" />
     23   </View0>
     24  </Doc3>
     25  <Doc4 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psVector.h" >
     26   <View0 line="123" Type="???" >
     27    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="832" Left="1" MinMaxMode="0" />
     28   </View0>
     29  </Doc4>
     30  <Doc5 NumberOfViews="1" URL="file:/home/desonia/psLib/src/dataManip/psFFT.c" >
     31   <View0 line="0" Type="???" >
     32    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" />
     33   </View0>
     34  </Doc5>
     35  <Doc6 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash00.c" >
     36   <View0 line="54" Type="???" >
     37    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" />
     38   </View0>
     39  </Doc6>
     40  <Doc7 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash01.c" >
     41   <View0 line="41" Type="???" >
     42    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" />
     43   </View0>
     44  </Doc7>
     45  <Doc8 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash02.c" >
     46   <View0 line="82" Type="???" >
     47    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" />
     48   </View0>
     49  </Doc8>
     50  <Doc9 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash03.c" >
     51   <View0 line="122" Type="???" >
     52    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" />
     53   </View0>
     54  </Doc9>
     55  <Doc10 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psHash04.c" >
     56   <View0 line="68" Type="???" >
     57    <AdditionalSettings Top="1" Width="1196" Attach="1" Height="631" Left="1" MinMaxMode="0" />
     58   </View0>
     59  </Doc10>
     60 </DocsAndViews>
    561 <pluginList>
    662  <kdevbookmarks>
  • trunk/psLib/src/collections/psBitSet.c

    r1041 r1073  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-06-15 02:45:43 $
     12 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5555/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
    5656/*****************************************************************************/
     57static void bitSetFree(psBitSet *restrict inBitSet);
     58
    5759
    5860/** Private function to create a mask.
     
    8890    numBytes = ceil(n/8.0);
    8991    newObj = psAlloc(sizeof(psBitSet));
     92    p_psMemSetDeallocator(newObj,(psFreeFcn)bitSetFree);
    9093    newObj->n = numBytes;
    9194
     
    98101}
    99102
    100 void psBitSetFree(psBitSet *restrict inBitSet)
     103static void bitSetFree(psBitSet *restrict inBitSet)
    101104{
    102105    if(inBitSet == NULL) {
     
    105108    }
    106109    psFree(inBitSet->bits);
    107     psFree(inBitSet);
    108110}
    109111
  • trunk/psLib/src/collections/psBitSet.h

    r974 r1073  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-06-10 01:58:06 $
     14 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-06-23 23:00:15 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454psBitSet* psBitSetAlloc(
    5555    int n   /**< Number of bits in psBitSet array */
    56 );
    57 
    58 /** Free a psBitSet
    59  *
    60  *  Deletes a psBitSet array.
    61  */
    62 void psBitSetFree(
    63     psBitSet *restrict inMask  /**< Pointer to psBitSet to be deleted. */
    6456);
    6557
  • trunk/psLib/src/collections/psList.c

    r1024 r1073  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-14 19:45:46 $
     8 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:15 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828
    2929// private functions.
    30 psListElem* listGetIterator(psList* list);
    31 int listGetIteratorIndex(psList* list);
    32 void listSetIterator(psList *list, int where, bool lockList);
     30static psListElem* listGetIterator(psList* list);
     31static int listGetIteratorIndex(psList* list);
     32static void listSetIterator(psList *list, int where, bool lockList);
     33static void listFree(psList *list);
    3334
    3435
     
    3637{
    3738    psList *list = psAlloc(sizeof(psList));
     39    p_psMemSetDeallocator(list,(psFreeFcn)listFree);
    3840
    3941    list->size = 0;
     
    4143    list->iter = ITER_INIT_HEAD;
    4244    list->iterIndex = PS_LIST_HEAD;
     45
    4346    pthread_mutex_init(&(list->lock),NULL)
    4447    ;
     
    5154}
    5255
    53 void psListFree(psList *list, psFreeFcn elemFree)
     56static void listFree(psList *list)
    5457{
    5558    if (list == NULL) {
     
    6366        psListElem *next = ptr->next;
    6467
    65         p_psCustomFree(elemFree, psMemDecrRefCounter(ptr->data));
     68        psFree(ptr->data);
    6669        psFree(ptr);
    6770
     
    7578    ;
    7679
    77     psFree(list);
    7880}
    7981
  • trunk/psLib/src/collections/psList.h

    r1017 r1073  
    1010 *  @ingroup LinkedList
    1111 *
    12  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-06-12 22:15:39 $
     12 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7373)
    7474;
    75 
    76 #include "psMemory.h"
    77 /** Destroys a psList linked list object.  This also frees the elements of the
    78  *  list using the psFreeFcn given, if any.  If no psFreeFcn is specified,
    79  *  the elements are just dereferenced via psMemDecrRefCounter(...).
    80  *
    81  */
    82 void psListFree(
    83     psList* restrict list,              ///< list to destroy
    84     psFreeFcn elemFree                  ///< destructor for data on list
    85 );
    8675
    8776/** Adds an element to a psList at position given.
  • trunk/psLib/src/collections/psSort.c

    r989 r1073  
    1414 *  @author Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2004-06-10 23:15:08 $
     16 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2004-06-23 23:00:15 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333#include "psSort.h"
    3434#include "psError.h"
     35#include "psMemory.h"
    3536
    3637/******************************************************************************/
     
    242243
    243244    // Free temp memory
    244     psVectorFree(tmpVector);
     245    psFree(tmpVector);
    245246
    246247    return outVector;
  • trunk/psLib/src/collections/psSort.d

    r986 r1073  
    1 psSort.o psSort.d : psSort.c psVector.h psType.h psSort.h ../sysUtils/psError.h
     1psSort.o psSort.d : psSort.c psVector.h psType.h psSort.h ../sysUtils/psError.h \
     2  ../sysUtils/psMemory.h
  • trunk/psLib/src/collections/psVector.c

    r1008 r1073  
    88 *  @author Ross Harman, MHPCC
    99 *
    10  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-06-12 01:33:16 $
     10 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-06-23 23:00:15 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4949/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
    5050/*****************************************************************************/
     51static void vectorFree(psVector *restrict psVec);
    5152
    5253/*****************************************************************************/
     
    6869    // Create vector struct
    6970    psVec = (psVector *)psAlloc(sizeof(psVector));
     71    p_psMemSetDeallocator(psVec,(psFreeFcn)vectorFree);
    7072
    7173    psVec->type.dimen = PS_DIMEN_VECTOR;
     
    132134    if(nalloc < 1) {
    133135        psError(__func__, "Invalid value for nalloc (%d)\n", nalloc);
    134         psVectorFree(in);
     136        psFree(in);
    135137        return NULL;
    136138    }
     
    154156}
    155157
    156 void psVectorFree(psVector *restrict psVec)
     158static void vectorFree(psVector *restrict psVec)
    157159{
    158160    if (psVec == NULL) {
     
    160162    }
    161163
     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
    162171    psFree(psVec->data.V);
    163     psFree(psVec);
    164172}
    165173
    166 void psVectorElementFree(psVector *restrict psVec, void (*elemFree)(void *))
     174void psVectorElementFree(psVector *restrict psVec)
    167175{
    168176
     
    176184    }
    177185
    178     for(int i = 0; i < psVec->nalloc; i++) {
    179         if(elemFree == NULL) {
    180             psMemDecrRefCounter(psVec->data.PTR[i]);
    181         } else {
    182             elemFree(psMemDecrRefCounter(psVec->data.PTR[i]));
    183         }
     186    for(int i = 0; i < psVec->n; i++) {
     187        psFree(psVec->data.PTR[i]);
    184188        psVec->data.PTR[i] = NULL;
    185189    }
  • trunk/psLib/src/collections/psVector.h

    r974 r1073  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-06-10 01:58:06 $
     13 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-06-23 23:00:15 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    100100);
    101101
    102 /** Deallocate a vector.
    103  *
    104  * Uses psLib memory allocation functions to deallocate a vector collection of data. The vector is deallocated
    105  * according to the psType type member contained within the vector.
    106  *
    107  * @return psVector*: Pointer to psVector.
    108  *
    109  */
    110 void psVectorFree(
    111     psVector *restrict psVec  ///< Vector to free.
    112 );
    113 
    114 
    115102/** Deallocate/Dereference elements of a void pointer vector.
    116103 *
     
    122109 */
    123110void psVectorElementFree(
    124     psVector *restrict psVec,   ///< Void pointer vector to destroy.
    125     void (*elemFree)(void *)    ///< Optional callback function to remove vector elements.
     111    psVector *restrict psVec    ///< Void pointer vector to destroy.
    126112);
    127113
  • trunk/psLib/src/dataManip/psFFT.c

    r1010 r1073  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-12 02:17:25 $
     7 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-23 23:00:15 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535    /* got good image data? */
    3636    if (in==NULL) {
    37         psImageFree(out);
     37        psFree(out);
    3838        return NULL;
    3939    }
     
    4444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    4545                type);
    46         psImageFree(out);
     46        psFree(out);
    4747        return NULL;
    4848    }
     
    5151        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    5252                type);
    53         psImageFree(out);
     53        psFree(out);
    5454        return NULL;
    5555
     
    7676    if (plan == NULL) {
    7777        psError(__func__,"Failed to create FFTW plan.");
    78         psImageFree(out);
     78        psFree(out);
    7979        return NULL;
    8080    }
     
    9898
    9999    if (in == NULL) {
    100         psImageFree(out);
     100        psFree(out);
    101101        return NULL;
    102102    }
     
    143143        psError(__func__,"Can not extract real component from given image type (%d).",
    144144                type);
    145         psImageFree(out);
     145        psFree(out);
    146146        return NULL;
    147147    }
     
    158158
    159159    if (in == NULL) {
    160         psImageFree(out);
     160        psFree(out);
    161161        return NULL;
    162162    }
     
    205205        psError(__func__,"Can not extract imaginary component from given image type (%d).",
    206206                type);
    207         psImageFree(out);
     207        psFree(out);
    208208        return NULL;
    209209    }
     
    220220
    221221    if (real == NULL || imag == NULL) {
    222         psImageFree(out);
     222        psFree(out);
    223223        return NULL;
    224224    }
     
    230230    if (imag->type.type != type) {
    231231        psError(__func__,"The inputs to psImageComplex must be the same type.");
    232         psImageFree(out);
     232        psFree(out);
    233233        return NULL;
    234234    }
     
    237237            imag->numRows != numRows) {
    238238        psError(__func__,"The inputs to psImageComplex must be the same dimensions.");
    239         psImageFree(out);
     239        psFree(out);
    240240        return NULL;
    241241    }
     
    243243    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    244244        psError(__func__,"The inputs to psImageComplex can not be complex.");
    245         psImageFree(out);
     245        psFree(out);
    246246        return NULL;
    247247    }
     
    249249    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
    250250        psError(__func__,"The input type to psImageComplex must be a floating point.");
    251         psImageFree(out);
     251        psFree(out);
    252252        return NULL;
    253253    }
     
    287287        psError(__func__,"Can not merge real and imaginary portions for given image type (%d).",
    288288                type);
    289         psImageFree(out);
     289        psFree(out);
    290290        return NULL;
    291291    }
     
    302302
    303303    if (in == NULL) {
    304         psImageFree(out);
     304        psFree(out);
    305305        return NULL;
    306306    }
     
    347347        psError(__func__,"Can not compute complex conjugate for given image type (%d).",
    348348                type);
    349         psImageFree(out);
     349        psFree(out);
    350350        return NULL;
    351351    }
     
    362362
    363363    if (in == NULL) {
    364         psImageFree(out);
     364        psFree(out);
    365365        return NULL;
    366366    }
     
    374374    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    375375        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
    376         psImageFree(out);
     376        psFree(out);
    377377        return NULL;
    378378    }
     
    417417        psError(__func__,"Can not power spectrum for given image type (%d).",
    418418                type);
    419         psImageFree(out);
     419        psFree(out);
    420420        return NULL;
    421421    }
     
    435435    /* got good image data? */
    436436    if (in==NULL) {
    437         psVectorFree(out);
     437        psFree(out);
    438438        return NULL;
    439439    }
     
    444444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    445445                type);
    446         psVectorFree(out);
     446        psFree(out);
    447447        return NULL;
    448448    }
     
    451451        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    452452                type);
    453         psVectorFree(out);
     453        psFree(out);
    454454        return NULL;
    455455
     
    491491    if (plan == NULL) {
    492492        psError(__func__,"Failed to create FFTW plan.");
    493         psVectorFree(out);
     493        psFree(out);
    494494        return NULL;
    495495    }
     
    510510
    511511    if (in == NULL) {
    512         psVectorFree(out);
     512        psFree(out);
    513513        return NULL;
    514514    }
     
    542542        psError(__func__,"Can not extract real component from given vector type (%d).",
    543543                type);
    544         psVectorFree(out);
     544        psFree(out);
    545545        return NULL;
    546546    }
     
    556556
    557557    if (in == NULL) {
    558         psVectorFree(out);
     558        psFree(out);
    559559        return NULL;
    560560    }
     
    588588        psError(__func__,"Can not extract imaginary component from given vector type (%d).",
    589589                type);
    590         psVectorFree(out);
     590        psFree(out);
    591591        return NULL;
    592592    }
     
    602602
    603603    if (real == NULL || imag == NULL) {
    604         psVectorFree(out);
     604        psFree(out);
    605605        return NULL;
    606606    }
     
    615615    if (imag->type.type != type) {
    616616        psError(__func__,"The inputs to psVectorComplex must be the same type.");
    617         psVectorFree(out);
     617        psFree(out);
    618618        return NULL;
    619619    }
     
    621621    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    622622        psError(__func__,"The inputs to psVectorComplex can not be complex.");
    623         psVectorFree(out);
     623        psFree(out);
    624624        return NULL;
    625625    }
     
    640640        psError(__func__,"Can not merge real and imaginary portions for given vector type (%d).",
    641641                type);
    642         psVectorFree(out);
     642        psFree(out);
    643643        return NULL;
    644644    }
     
    654654
    655655    if (in == NULL) {
    656         psVectorFree(out);
     656        psFree(out);
    657657        return NULL;
    658658    }
     
    687687        psError(__func__,"Can not compute complex conjugate for given vector type (%d).",
    688688                type);
    689         psVectorFree(out);
     689        psFree(out);
    690690        return NULL;
    691691    }
     
    703703
    704704    if (in == NULL) {
    705         psVectorFree(out);
     705        psFree(out);
    706706        return NULL;
    707707    }
     
    716716    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    717717        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
    718         psVectorFree(out);
     718        psFree(out);
    719719        return NULL;
    720720    }
     
    747747        psError(__func__,"Can not power spectrum for given vector type (%d).",
    748748                type);
    749         psVectorFree(out);
    750         return NULL;
    751     }
    752 
    753     return out;
    754 
    755 }
     749        psFree(out);
     750        return NULL;
     751    }
     752
     753    return out;
     754
     755}
  • trunk/psLib/src/dataManip/psFunctions.c

    r1022 r1073  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-06-14 19:40:14 $
     9 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-06-23 23:00:15 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434#include <gsl/gsl_rng.h>
    3535#include <gsl/gsl_randist.h>
     36
     37static void polynomial1DFree(psPolynomial1D *myPoly);
     38static void polynomial2DFree(psPolynomial2D *myPoly);
     39static void polynomial3DFree(psPolynomial3D *myPoly);
     40static void polynomial4DFree(psPolynomial4D *myPoly);
     41static void dPolynomial1DFree(psDPolynomial1D *myPoly);
     42static void dPolynomial2DFree(psDPolynomial2D *myPoly);
     43static void dPolynomial3DFree(psDPolynomial3D *myPoly);
     44static void dPolynomial4DFree(psDPolynomial4D *myPoly);
     45
    3646/*****************************************************************************/
    3747/*  FUNCTION IMPLEMENTATION - PUBLIC                                         */
     
    108118
    109119    newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
     120    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree);
    110121    newPoly->n = n;
    111122    newPoly->coeff    = (float *) psAlloc(n * sizeof(float));
     
    128139
    129140    newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
     141    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree);
    130142    newPoly->nX = nX;
    131143    newPoly->nY = nY;
     
    158170
    159171    newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
     172    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree);
    160173    newPoly->nX = nX;
    161174    newPoly->nY = nY;
     
    197210
    198211    newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
     212    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree);
    199213    newPoly->nW = nW;
    200214    newPoly->nX = nX;
     
    235249}
    236250
    237 void psPolynomial1DFree(psPolynomial1D *myPoly)
     251static void polynomial1DFree(psPolynomial1D *myPoly)
    238252{
    239253    psFree(myPoly->coeff);
    240254    psFree(myPoly->coeffErr);
    241255    psFree(myPoly->mask);
    242     psFree(myPoly);
    243 }
    244 
    245 void psPolynomial2DFree(psPolynomial2D *myPoly)
     256}
     257
     258static void polynomial2DFree(psPolynomial2D *myPoly)
    246259{
    247260    int x = 0;
     
    255268    psFree(myPoly->coeffErr);
    256269    psFree(myPoly->mask);
    257 
    258     psFree(myPoly);
    259 }
    260 
    261 void psPolynomial3DFree(psPolynomial3D *myPoly)
     270}
     271
     272static void polynomial3DFree(psPolynomial3D *myPoly)
    262273{
    263274    int x = 0;
     
    278289    psFree(myPoly->coeffErr);
    279290    psFree(myPoly->mask);
    280     psFree(myPoly);
    281 }
    282 
    283 void psPolynomial4DFree(psPolynomial4D *myPoly)
     291}
     292
     293static void polynomial4DFree(psPolynomial4D *myPoly)
    284294{
    285295    int w = 0;
     
    306316    psFree(myPoly->coeffErr);
    307317    psFree(myPoly->mask);
    308     psFree(myPoly);
    309318}
    310319
     
    434443
    435444    newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
     445    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree);
    436446    newPoly->n = n;
    437447    newPoly->coeff    = (double *) psAlloc(n * sizeof(double));
     
    454464
    455465    newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
     466    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree);
    456467    newPoly->nX = nX;
    457468    newPoly->nY = nY;
     
    484495
    485496    newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
     497    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree);
    486498    newPoly->nX = nX;
    487499    newPoly->nY = nY;
     
    523535
    524536    newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
     537    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree);
    525538    newPoly->nW = nW;
    526539    newPoly->nX = nX;
     
    561574}
    562575
    563 void psDPolynomial1DFree(psDPolynomial1D *myPoly)
     576static void dPolynomial1DFree(psDPolynomial1D *myPoly)
    564577{
    565578    psFree(myPoly->coeff);
    566579    psFree(myPoly->coeffErr);
    567580    psFree(myPoly->mask);
    568     psFree(myPoly);
    569 }
    570 
    571 void psDPolynomial2DFree(psDPolynomial2D *myPoly)
     581}
     582
     583static void dPolynomial2DFree(psDPolynomial2D *myPoly)
    572584{
    573585    int x = 0;
     
    581593    psFree(myPoly->coeffErr);
    582594    psFree(myPoly->mask);
    583 
    584     psFree(myPoly);
    585 }
    586 
    587 void psDPolynomial3DFree(psDPolynomial3D *myPoly)
     595}
     596
     597static void dPolynomial3DFree(psDPolynomial3D *myPoly)
    588598{
    589599    int x = 0;
     
    604614    psFree(myPoly->coeffErr);
    605615    psFree(myPoly->mask);
    606     psFree(myPoly);
    607 }
    608 
    609 void psDPolynomial4DFree(psDPolynomial4D *myPoly)
     616}
     617
     618static void dPolynomial4DFree(psDPolynomial4D *myPoly)
    610619{
    611620    int w = 0;
     
    632641    psFree(myPoly->coeffErr);
    633642    psFree(myPoly->mask);
    634     psFree(myPoly);
    635643}
    636644
  • trunk/psLib/src/dataManip/psFunctions.h

    r1020 r1073  
    1212 *  @author George Gusciora, MHPCC
    1313 *
    14  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-06-14 19:32:42 $
     14 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-06-23 23:00:15 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    104104                                   );
    105105
    106 /** Destructor */
    107 void psPolynomial1DFree(psPolynomial1D *myPoly ///< Polynomial to destroy
    108                        );
    109 
    110 /** Destructor */
    111 void psPolynomial2DFree(psPolynomial2D *myPoly ///< Polynomial to destroy
    112                        );
    113 /** Destructor */
    114 void psPolynomial3DFree(psPolynomial3D *myPoly ///< Polynomial to destroy
    115                        );
    116 /** Destructor */
    117 void psPolynomial4DFree(psPolynomial4D *myPoly ///< Polynomial to destroy
    118                        );
    119 
    120 
    121106/** Evaluate 1D polynomial */
    122107float
     
    206191                                     );
    207192
    208 
    209 /** Destructor */
    210 void psDPolynomial1DFree(psDPolynomial1D *myPoly ///< Polynomial to destroy
    211                         );
    212 /** Destructor */
    213 void psDPolynomial2DFree(psDPolynomial2D *myPoly ///< Polynomial to destroy
    214                         );
    215 /** Destructor */
    216 void psDPolynomial3DFree(psDPolynomial3D *myPoly ///< Polynomial to destroy
    217                         );
    218 /** Destructor */
    219 void psDPolynomial4DFree(psDPolynomial4D *myPoly ///< Polynomial to destroy
    220                         );
    221 
    222 
    223193/** Evaluate 1D polynomial (double precision) */
    224194double
  • trunk/psLib/src/dataManip/psStats.c

    r1071 r1073  
    3232                           psStats *stats);
    3333#endif
     34
     35static void histogramFree(psHistogram *myHist);
    3436
    3537/******************************************************************************
     
    6870
    6971/******************************************************************************
    70     psStatsFree(): This routine must free the psStats data structure.
    71  *****************************************************************************/
    72 void psStatsFree(psStats *stats)
    73 {
    74     psFree(stats);
    75 }
    76 
    77 /******************************************************************************
    7872psHistogramAlloc(lower, upper, n): allocate a uniform histogram structure
    7973with the specifed upper and lower limits, and the specifed number of bins.
     
    108102    // bins, then there are N+1 bounds to those bins.
    109103    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     104    p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree);
    110105    newHist->bounds = psVectorAlloc(n+1, PS_TYPE_F32);
    111106    newHist->bounds->n = newHist->bounds->nalloc;
     
    160155    // Allocate memory for the new histogram structure.
    161156    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     157    p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree);
    162158    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
    163159    newHist->bounds->n = newHist->bounds->nalloc;
     
    182178}
    183179
    184 void psHistogramFree(psHistogram *myHist)
    185 {
    186     psVectorFree(myHist->bounds);
    187     psVectorFree(myHist->nums);
    188     psFree(myHist);
     180static void histogramFree(psHistogram *myHist)
     181{
     182    psFree(myHist->bounds);
     183    psFree(myHist->nums);
    189184}
    190185
     
    618613
    619614        // Free temporary data buffers.
    620         psStatsFree(stats2);
     615        psFree(stats2);
    621616
    622617        // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure.
     
    688683
    689684    // Free the temporary data structures.
    690     psVectorFree(unsortedVector);
    691     psVectorFree(sortedVector);
     685    psFree(unsortedVector);
     686    psFree(sortedVector);
    692687}
    693688
     
    775770
    776771        // Free temporary data buffers.
    777         psStatsFree(stats2);
     772        psFree(stats2);
    778773
    779774        // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure.
     
    840835
    841836    // Free the temporary data structures.
    842     psVectorFree(unsortedVector);
    843     psVectorFree(sortedVector);
     837    psFree(unsortedVector);
     838    psFree(sortedVector);
    844839    // NOTE: This is the
    845840}
     
    10431038    }
    10441039
    1045     psVectorFree(tmpMask);
     1040    psFree(tmpMask);
    10461041}
    10471042
     
    11251120            stats->robustLQ = stats->clippedMean;
    11261121        }
    1127         psStatsFree(tmpStats);
    1128         psHistogramFree(robustHistogram);
     1122        psFree(tmpStats);
     1123        psFree(robustHistogram);
    11291124        return;
    11301125    }
     
    12001195    stats->robustNfit = 0.0;
    12011196    stats->robustN50 = 0.0;
    1202     psStatsFree(tmpStats);
    1203     psHistogramFree(robustHistogram);
     1197    psFree(tmpStats);
     1198    psFree(robustHistogram);
    12041199}
    12051200
  • trunk/psLib/src/dataManip/psStats.h

    r1020 r1073  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-06-14 19:33:09 $
     11 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-06-23 23:00:15 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8888psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure
    8989
    90 /** A destructor for the stats structure.*/
    91 void psStatsFree(psStats *restrict stats); ///< Stats structure to destroy
    92 
    9390/******************************************************************************
    9491    Histogram functions and data structures.
     
    116113psHistogram * psHistogramAllocGeneric(const psVector *restrict bounds); ///< Bounds for the bins
    117114
    118 
    119 /** Destructor \ingroup MathGroup **/
    120 void psHistogramFree(psHistogram *myHist);          ///< Histogram to destroy
    121 
    122 
    123115/** Calculate a histogram \ingroup MathGroup **/
    124116psHistogram *psHistogramVector (psHistogram *out,   ///< Histogram data
  • trunk/psLib/src/dataManip/psVectorFFT.c

    r1010 r1073  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-12 02:17:25 $
     7 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-23 23:00:15 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535    /* got good image data? */
    3636    if (in==NULL) {
    37         psImageFree(out);
     37        psFree(out);
    3838        return NULL;
    3939    }
     
    4444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    4545                type);
    46         psImageFree(out);
     46        psFree(out);
    4747        return NULL;
    4848    }
     
    5151        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    5252                type);
    53         psImageFree(out);
     53        psFree(out);
    5454        return NULL;
    5555
     
    7676    if (plan == NULL) {
    7777        psError(__func__,"Failed to create FFTW plan.");
    78         psImageFree(out);
     78        psFree(out);
    7979        return NULL;
    8080    }
     
    9898
    9999    if (in == NULL) {
    100         psImageFree(out);
     100        psFree(out);
    101101        return NULL;
    102102    }
     
    143143        psError(__func__,"Can not extract real component from given image type (%d).",
    144144                type);
    145         psImageFree(out);
     145        psFree(out);
    146146        return NULL;
    147147    }
     
    158158
    159159    if (in == NULL) {
    160         psImageFree(out);
     160        psFree(out);
    161161        return NULL;
    162162    }
     
    205205        psError(__func__,"Can not extract imaginary component from given image type (%d).",
    206206                type);
    207         psImageFree(out);
     207        psFree(out);
    208208        return NULL;
    209209    }
     
    220220
    221221    if (real == NULL || imag == NULL) {
    222         psImageFree(out);
     222        psFree(out);
    223223        return NULL;
    224224    }
     
    230230    if (imag->type.type != type) {
    231231        psError(__func__,"The inputs to psImageComplex must be the same type.");
    232         psImageFree(out);
     232        psFree(out);
    233233        return NULL;
    234234    }
     
    237237            imag->numRows != numRows) {
    238238        psError(__func__,"The inputs to psImageComplex must be the same dimensions.");
    239         psImageFree(out);
     239        psFree(out);
    240240        return NULL;
    241241    }
     
    243243    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    244244        psError(__func__,"The inputs to psImageComplex can not be complex.");
    245         psImageFree(out);
     245        psFree(out);
    246246        return NULL;
    247247    }
     
    249249    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
    250250        psError(__func__,"The input type to psImageComplex must be a floating point.");
    251         psImageFree(out);
     251        psFree(out);
    252252        return NULL;
    253253    }
     
    287287        psError(__func__,"Can not merge real and imaginary portions for given image type (%d).",
    288288                type);
    289         psImageFree(out);
     289        psFree(out);
    290290        return NULL;
    291291    }
     
    302302
    303303    if (in == NULL) {
    304         psImageFree(out);
     304        psFree(out);
    305305        return NULL;
    306306    }
     
    347347        psError(__func__,"Can not compute complex conjugate for given image type (%d).",
    348348                type);
    349         psImageFree(out);
     349        psFree(out);
    350350        return NULL;
    351351    }
     
    362362
    363363    if (in == NULL) {
    364         psImageFree(out);
     364        psFree(out);
    365365        return NULL;
    366366    }
     
    374374    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    375375        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
    376         psImageFree(out);
     376        psFree(out);
    377377        return NULL;
    378378    }
     
    417417        psError(__func__,"Can not power spectrum for given image type (%d).",
    418418                type);
    419         psImageFree(out);
     419        psFree(out);
    420420        return NULL;
    421421    }
     
    435435    /* got good image data? */
    436436    if (in==NULL) {
    437         psVectorFree(out);
     437        psFree(out);
    438438        return NULL;
    439439    }
     
    444444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    445445                type);
    446         psVectorFree(out);
     446        psFree(out);
    447447        return NULL;
    448448    }
     
    451451        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    452452                type);
    453         psVectorFree(out);
     453        psFree(out);
    454454        return NULL;
    455455
     
    491491    if (plan == NULL) {
    492492        psError(__func__,"Failed to create FFTW plan.");
    493         psVectorFree(out);
     493        psFree(out);
    494494        return NULL;
    495495    }
     
    510510
    511511    if (in == NULL) {
    512         psVectorFree(out);
     512        psFree(out);
    513513        return NULL;
    514514    }
     
    542542        psError(__func__,"Can not extract real component from given vector type (%d).",
    543543                type);
    544         psVectorFree(out);
     544        psFree(out);
    545545        return NULL;
    546546    }
     
    556556
    557557    if (in == NULL) {
    558         psVectorFree(out);
     558        psFree(out);
    559559        return NULL;
    560560    }
     
    588588        psError(__func__,"Can not extract imaginary component from given vector type (%d).",
    589589                type);
    590         psVectorFree(out);
     590        psFree(out);
    591591        return NULL;
    592592    }
     
    602602
    603603    if (real == NULL || imag == NULL) {
    604         psVectorFree(out);
     604        psFree(out);
    605605        return NULL;
    606606    }
     
    615615    if (imag->type.type != type) {
    616616        psError(__func__,"The inputs to psVectorComplex must be the same type.");
    617         psVectorFree(out);
     617        psFree(out);
    618618        return NULL;
    619619    }
     
    621621    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    622622        psError(__func__,"The inputs to psVectorComplex can not be complex.");
    623         psVectorFree(out);
     623        psFree(out);
    624624        return NULL;
    625625    }
     
    640640        psError(__func__,"Can not merge real and imaginary portions for given vector type (%d).",
    641641                type);
    642         psVectorFree(out);
     642        psFree(out);
    643643        return NULL;
    644644    }
     
    654654
    655655    if (in == NULL) {
    656         psVectorFree(out);
     656        psFree(out);
    657657        return NULL;
    658658    }
     
    687687        psError(__func__,"Can not compute complex conjugate for given vector type (%d).",
    688688                type);
    689         psVectorFree(out);
     689        psFree(out);
    690690        return NULL;
    691691    }
     
    703703
    704704    if (in == NULL) {
    705         psVectorFree(out);
     705        psFree(out);
    706706        return NULL;
    707707    }
     
    716716    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    717717        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
    718         psVectorFree(out);
     718        psFree(out);
    719719        return NULL;
    720720    }
     
    747747        psError(__func__,"Can not power spectrum for given vector type (%d).",
    748748                type);
    749         psVectorFree(out);
    750         return NULL;
    751     }
    752 
    753     return out;
    754 
    755 }
     749        psFree(out);
     750        return NULL;
     751    }
     752
     753    return out;
     754
     755}
  • trunk/psLib/src/fft/psVectorFFT.c

    r1010 r1073  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-12 02:17:25 $
     7 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-23 23:00:15 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535    /* got good image data? */
    3636    if (in==NULL) {
    37         psImageFree(out);
     37        psFree(out);
    3838        return NULL;
    3939    }
     
    4444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    4545                type);
    46         psImageFree(out);
     46        psFree(out);
    4747        return NULL;
    4848    }
     
    5151        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    5252                type);
    53         psImageFree(out);
     53        psFree(out);
    5454        return NULL;
    5555
     
    7676    if (plan == NULL) {
    7777        psError(__func__,"Failed to create FFTW plan.");
    78         psImageFree(out);
     78        psFree(out);
    7979        return NULL;
    8080    }
     
    9898
    9999    if (in == NULL) {
    100         psImageFree(out);
     100        psFree(out);
    101101        return NULL;
    102102    }
     
    143143        psError(__func__,"Can not extract real component from given image type (%d).",
    144144                type);
    145         psImageFree(out);
     145        psFree(out);
    146146        return NULL;
    147147    }
     
    158158
    159159    if (in == NULL) {
    160         psImageFree(out);
     160        psFree(out);
    161161        return NULL;
    162162    }
     
    205205        psError(__func__,"Can not extract imaginary component from given image type (%d).",
    206206                type);
    207         psImageFree(out);
     207        psFree(out);
    208208        return NULL;
    209209    }
     
    220220
    221221    if (real == NULL || imag == NULL) {
    222         psImageFree(out);
     222        psFree(out);
    223223        return NULL;
    224224    }
     
    230230    if (imag->type.type != type) {
    231231        psError(__func__,"The inputs to psImageComplex must be the same type.");
    232         psImageFree(out);
     232        psFree(out);
    233233        return NULL;
    234234    }
     
    237237            imag->numRows != numRows) {
    238238        psError(__func__,"The inputs to psImageComplex must be the same dimensions.");
    239         psImageFree(out);
     239        psFree(out);
    240240        return NULL;
    241241    }
     
    243243    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    244244        psError(__func__,"The inputs to psImageComplex can not be complex.");
    245         psImageFree(out);
     245        psFree(out);
    246246        return NULL;
    247247    }
     
    249249    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
    250250        psError(__func__,"The input type to psImageComplex must be a floating point.");
    251         psImageFree(out);
     251        psFree(out);
    252252        return NULL;
    253253    }
     
    287287        psError(__func__,"Can not merge real and imaginary portions for given image type (%d).",
    288288                type);
    289         psImageFree(out);
     289        psFree(out);
    290290        return NULL;
    291291    }
     
    302302
    303303    if (in == NULL) {
    304         psImageFree(out);
     304        psFree(out);
    305305        return NULL;
    306306    }
     
    347347        psError(__func__,"Can not compute complex conjugate for given image type (%d).",
    348348                type);
    349         psImageFree(out);
     349        psFree(out);
    350350        return NULL;
    351351    }
     
    362362
    363363    if (in == NULL) {
    364         psImageFree(out);
     364        psFree(out);
    365365        return NULL;
    366366    }
     
    374374    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    375375        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
    376         psImageFree(out);
     376        psFree(out);
    377377        return NULL;
    378378    }
     
    417417        psError(__func__,"Can not power spectrum for given image type (%d).",
    418418                type);
    419         psImageFree(out);
     419        psFree(out);
    420420        return NULL;
    421421    }
     
    435435    /* got good image data? */
    436436    if (in==NULL) {
    437         psVectorFree(out);
     437        psFree(out);
    438438        return NULL;
    439439    }
     
    444444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    445445                type);
    446         psVectorFree(out);
     446        psFree(out);
    447447        return NULL;
    448448    }
     
    451451        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    452452                type);
    453         psVectorFree(out);
     453        psFree(out);
    454454        return NULL;
    455455
     
    491491    if (plan == NULL) {
    492492        psError(__func__,"Failed to create FFTW plan.");
    493         psVectorFree(out);
     493        psFree(out);
    494494        return NULL;
    495495    }
     
    510510
    511511    if (in == NULL) {
    512         psVectorFree(out);
     512        psFree(out);
    513513        return NULL;
    514514    }
     
    542542        psError(__func__,"Can not extract real component from given vector type (%d).",
    543543                type);
    544         psVectorFree(out);
     544        psFree(out);
    545545        return NULL;
    546546    }
     
    556556
    557557    if (in == NULL) {
    558         psVectorFree(out);
     558        psFree(out);
    559559        return NULL;
    560560    }
     
    588588        psError(__func__,"Can not extract imaginary component from given vector type (%d).",
    589589                type);
    590         psVectorFree(out);
     590        psFree(out);
    591591        return NULL;
    592592    }
     
    602602
    603603    if (real == NULL || imag == NULL) {
    604         psVectorFree(out);
     604        psFree(out);
    605605        return NULL;
    606606    }
     
    615615    if (imag->type.type != type) {
    616616        psError(__func__,"The inputs to psVectorComplex must be the same type.");
    617         psVectorFree(out);
     617        psFree(out);
    618618        return NULL;
    619619    }
     
    621621    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    622622        psError(__func__,"The inputs to psVectorComplex can not be complex.");
    623         psVectorFree(out);
     623        psFree(out);
    624624        return NULL;
    625625    }
     
    640640        psError(__func__,"Can not merge real and imaginary portions for given vector type (%d).",
    641641                type);
    642         psVectorFree(out);
     642        psFree(out);
    643643        return NULL;
    644644    }
     
    654654
    655655    if (in == NULL) {
    656         psVectorFree(out);
     656        psFree(out);
    657657        return NULL;
    658658    }
     
    687687        psError(__func__,"Can not compute complex conjugate for given vector type (%d).",
    688688                type);
    689         psVectorFree(out);
     689        psFree(out);
    690690        return NULL;
    691691    }
     
    703703
    704704    if (in == NULL) {
    705         psVectorFree(out);
     705        psFree(out);
    706706        return NULL;
    707707    }
     
    716716    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    717717        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
    718         psVectorFree(out);
     718        psFree(out);
    719719        return NULL;
    720720    }
     
    747747        psError(__func__,"Can not power spectrum for given vector type (%d).",
    748748                type);
    749         psVectorFree(out);
    750         return NULL;
    751     }
    752 
    753     return out;
    754 
    755 }
     749        psFree(out);
     750        return NULL;
     751    }
     752
     753    return out;
     754
     755}
  • trunk/psLib/src/image/psImage.c

    r996 r1073  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-06-11 02:02:53 $
     11 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-06-23 23:00:15 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828#include "psImage.h"
    2929
     30static void imageFree(psImage* image);
    3031
    3132/*****************************************************************************/
     
    4950
    5051    psImage *image = (psImage *)psAlloc(sizeof(psImage));
     52    p_psMemSetDeallocator(image,(psFreeFcn)imageFree);
    5153
    5254    image->data.V = psAlloc(sizeof(void*)*numRows);
     
    7173}
    7274
    73 void psImageFree(psImage *image)
     75static void imageFree(psImage* image)
    7476{
    7577    if (image == NULL) {
     
    9698    psFree(image->data.V);
    9799    image->data.V = NULL;
    98 
    99     psFree(image);
    100100}
    101101
     
    237237        if (children[i] != NULL) {
    238238            numFreed++;
    239             psImageFree(children[i]);
     239            psFree(children[i]);
    240240        }
    241241    }
     
    341341    case PS_TYPE_PTR: \
    342342        psError(__func__,"Can't copy image from a matrix of pointers."); \
    343         psImageFree(output); \
     343        psFree(output); \
    344344        return NULL; \
    345345    default: \
     
    391391    case PS_TYPE_PTR:
    392392        psError(__func__,"Can't copy image into a matrix of pointers.");
    393         psImageFree(output);
     393        psFree(output);
    394394        return NULL;
    395395    }
     
    534534        case PS_TYPE_PTR:
    535535            psError (__func__, "Can't copy image from a matrix of pointers.");
    536             psImageFree (output);
     536            psFree (output);
    537537            return ((void *) 0);
    538538        default:
     
    676676        case PS_TYPE_PTR:
    677677            psError (__func__, "Can't copy image from a matrix of pointers.");
    678             psImageFree (output);
     678            psFree (output);
    679679            return ((void *) 0);
    680680        default:
     
    818818        case PS_TYPE_PTR:
    819819            psError (__func__, "Can't copy image from a matrix of pointers.");
    820             psImageFree (output);
     820            psFree (output);
    821821            return ((void *) 0);
    822822        default:
     
    960960        case PS_TYPE_PTR:
    961961            psError (__func__, "Can't copy image from a matrix of pointers.");
    962             psImageFree (output);
     962            psFree (output);
    963963            return ((void *) 0);
    964964        default:
     
    11021102        case PS_TYPE_PTR:
    11031103            psError (__func__, "Can't copy image from a matrix of pointers.");
    1104             psImageFree (output);
     1104            psFree (output);
    11051105            return ((void *) 0);
    11061106        default:
     
    12441244        case PS_TYPE_PTR:
    12451245            psError (__func__, "Can't copy image from a matrix of pointers.");
    1246             psImageFree (output);
     1246            psFree (output);
    12471247            return ((void *) 0);
    12481248        default:
     
    13861386        case PS_TYPE_PTR:
    13871387            psError (__func__, "Can't copy image from a matrix of pointers.");
    1388             psImageFree (output);
     1388            psFree (output);
    13891389            return ((void *) 0);
    13901390        default:
     
    15281528        case PS_TYPE_PTR:
    15291529            psError (__func__, "Can't copy image from a matrix of pointers.");
    1530             psImageFree (output);
     1530            psFree (output);
    15311531            return ((void *) 0);
    15321532        default:
     
    16701670        case PS_TYPE_PTR:
    16711671            psError (__func__, "Can't copy image from a matrix of pointers.");
    1672             psImageFree (output);
     1672            psFree (output);
    16731673            return ((void *) 0);
    16741674        default:
     
    18121812        case PS_TYPE_PTR:
    18131813            psError (__func__, "Can't copy image from a matrix of pointers.");
    1814             psImageFree (output);
     1814            psFree (output);
    18151815            return ((void *) 0);
    18161816        default:
     
    19541954        case PS_TYPE_PTR:
    19551955            psError (__func__, "Can't copy image from a matrix of pointers.");
    1956             psImageFree (output);
     1956            psFree (output);
    19571957            return ((void *) 0);
    19581958        default:
     
    20962096        case PS_TYPE_PTR:
    20972097            psError (__func__, "Can't copy image from a matrix of pointers.");
    2098             psImageFree (output);
     2098            psFree (output);
    20992099            return ((void *) 0);
    21002100        default:
     
    21042104    case PS_TYPE_PTR:
    21052105        psError (__func__, "Can't copy image into a matrix of pointers.");
    2106         psImageFree (output);
     2106        psFree (output);
    21072107        return ((void *) 0);
    21082108    }
  • trunk/psLib/src/image/psImage.h

    r974 r1073  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-06-10 01:58:06 $
     13 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-06-23 23:00:15 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    110110);
    111111
    112 /** Destroy the specified image.
    113  *
    114  *  Uses psLib memory deallocation functions to free an image and any existing
    115  *  children.
    116  *
    117  */
    118 void psImageFree(
    119     psImage *restrict image             ///< Free psImage
    120 );
    121 
    122112/** Frees all children of a psImage.
    123113 *
  • trunk/psLib/src/image/psImageIO.c

    r997 r1073  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-06-11 03:45:07 $
     9 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-06-23 23:00:15 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#include "psImageIO.h"
    2020#include "psError.h"
     21#include "psMemory.h"
    2122
    2223psImage* psImageReadSection(psImage* output, int col, int row, int numCols,
     
    3940    if (filename == NULL) {
    4041        psError(__func__,"Must specify filename; it can not be NULL.");
    41         psImageFree(output);
     42        psFree(output);
    4243        return NULL;
    4344    }
     
    4950        psError(__func__,"Could not open file '%s'. (%s)",
    5051                filename, fitsErr);
    51         psImageFree(output);
     52        psFree(output);
    5253        return NULL;
    5354    }
     
    6162            psError(__func__,"Could not index to '%s' HDU for file %s. (%s)",
    6263                    extname, filename, fitsErr);
    63             psImageFree(output);
     64            psFree(output);
    6465            return NULL;
    6566        }
     
    7172            psError(__func__,"Could not index to HDU #%d for file %s. (%s)",
    7273                    extnum, filename, fitsErr);
    73             psImageFree(output);
     74            psFree(output);
    7475            return NULL;
    7576        }
     
    8384        psError("Could not determine image data type of '%s'. (%s)",
    8485                filename, fitsErr);
    85         psImageFree(output);
     86        psFree(output);
    8687        return NULL;
    8788    }
     
    9495        psError("Could not determine dimensions of '%s'. (%s)",
    9596                filename,fitsErr);
    96         psImageFree(output);
     97        psFree(output);
    9798        return NULL;
    9899    }
     
    104105        psError("Dimensions of '%s' are not supported (NAXIS=%i).",
    105106                filename, nAxis);
    106         psImageFree(output);
     107        psFree(output);
    107108        return NULL;
    108109    }
     
    115116        psError("Could not determine image size of '%s'. (%s)",
    116117                filename,fitsErr);
    117         psImageFree(output);
     118        psFree(output);
    118119        return NULL;
    119120    }
     
    181182        psError(__func__,"Unsupported bitpix value (%d) in FITS file %s.",
    182183                bitPix,filename);
    183         psImageFree(output);
     184        psFree(output);
    184185        return NULL;
    185186    }
     
    187188    if (fits_read_subset(fptr, fitsDatatype, firstPixel, lastPixel, increment,
    188189                         NULL, output->data.V[0], &anynull, &status) != 0) {
    189         psImageFree(output);
     190        psFree(output);
    190191        (void)fits_get_errstatus(status, fitsErr);
    191192        status = 0;
  • trunk/psLib/src/image/psImageIO.d

    r986 r1073  
    11psImageIO.o psImageIO.d : psImageIO.c psImageIO.h ../collections/psImage.h \
    2   ../collections/psType.h ../sysUtils/psError.h
     2  ../collections/psType.h ../sysUtils/psError.h ../sysUtils/psMemory.h
  • trunk/psLib/src/image/psImageStats.c

    r1072 r1073  
    6767
    6868        stats = psVectorStats(stats, junkData, junkMask, maskVal);
    69         psVectorFree(junkMask);
     69        psFree(junkMask);
    7070    } else {
    7171        stats = psVectorStats(stats, junkData, NULL, 0);
    7272    }
    73     psVectorFree(junkData);
     73    psFree(junkData);
    7474    return(stats);
    7575}
     
    129129        }
    130130        out = psHistogramVector(out, junkData, junkMask, maskVal);
    131         psVectorFree(junkMask);
     131        psFree(junkMask);
    132132    } else {
    133133        out = psHistogramVector(out, junkData, NULL, 0);
    134134    }
    135     psVectorFree(junkData);
     135    psFree(junkData);
    136136
    137137    return(out);
     
    339339    // Free the Chebyshev polynomials that were created in this routine.
    340340    for (i=0;i<maxChebyPoly;i++) {
    341         psPolynomial1DFree(chebPolys[i]);
     341        psFree(chebPolys[i]);
    342342    }
    343343    psFree(chebPolys);
     
    413413    // Free the Chebyshev polynomials that were created in this routine.
    414414    for (i=0;i<maxChebyPoly;i++) {
    415         psPolynomial1DFree(chebPolys[i]);
     415        psFree(chebPolys[i]);
    416416    }
    417417    psFree(chebPolys);
  • trunk/psLib/src/imageops/psImageStats.c

    r1072 r1073  
    6767
    6868        stats = psVectorStats(stats, junkData, junkMask, maskVal);
    69         psVectorFree(junkMask);
     69        psFree(junkMask);
    7070    } else {
    7171        stats = psVectorStats(stats, junkData, NULL, 0);
    7272    }
    73     psVectorFree(junkData);
     73    psFree(junkData);
    7474    return(stats);
    7575}
     
    129129        }
    130130        out = psHistogramVector(out, junkData, junkMask, maskVal);
    131         psVectorFree(junkMask);
     131        psFree(junkMask);
    132132    } else {
    133133        out = psHistogramVector(out, junkData, NULL, 0);
    134134    }
    135     psVectorFree(junkData);
     135    psFree(junkData);
    136136
    137137    return(out);
     
    339339    // Free the Chebyshev polynomials that were created in this routine.
    340340    for (i=0;i<maxChebyPoly;i++) {
    341         psPolynomial1DFree(chebPolys[i]);
     341        psFree(chebPolys[i]);
    342342    }
    343343    psFree(chebPolys);
     
    413413    // Free the Chebyshev polynomials that were created in this routine.
    414414    for (i=0;i<maxChebyPoly;i++) {
    415         psPolynomial1DFree(chebPolys[i]);
     415        psFree(chebPolys[i]);
    416416    }
    417417    psFree(chebPolys);
  • trunk/psLib/src/math/psPolynomial.c

    r1022 r1073  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-06-14 19:40:14 $
     9 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-06-23 23:00:15 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434#include <gsl/gsl_rng.h>
    3535#include <gsl/gsl_randist.h>
     36
     37static void polynomial1DFree(psPolynomial1D *myPoly);
     38static void polynomial2DFree(psPolynomial2D *myPoly);
     39static void polynomial3DFree(psPolynomial3D *myPoly);
     40static void polynomial4DFree(psPolynomial4D *myPoly);
     41static void dPolynomial1DFree(psDPolynomial1D *myPoly);
     42static void dPolynomial2DFree(psDPolynomial2D *myPoly);
     43static void dPolynomial3DFree(psDPolynomial3D *myPoly);
     44static void dPolynomial4DFree(psDPolynomial4D *myPoly);
     45
    3646/*****************************************************************************/
    3747/*  FUNCTION IMPLEMENTATION - PUBLIC                                         */
     
    108118
    109119    newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
     120    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree);
    110121    newPoly->n = n;
    111122    newPoly->coeff    = (float *) psAlloc(n * sizeof(float));
     
    128139
    129140    newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
     141    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree);
    130142    newPoly->nX = nX;
    131143    newPoly->nY = nY;
     
    158170
    159171    newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
     172    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree);
    160173    newPoly->nX = nX;
    161174    newPoly->nY = nY;
     
    197210
    198211    newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
     212    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree);
    199213    newPoly->nW = nW;
    200214    newPoly->nX = nX;
     
    235249}
    236250
    237 void psPolynomial1DFree(psPolynomial1D *myPoly)
     251static void polynomial1DFree(psPolynomial1D *myPoly)
    238252{
    239253    psFree(myPoly->coeff);
    240254    psFree(myPoly->coeffErr);
    241255    psFree(myPoly->mask);
    242     psFree(myPoly);
    243 }
    244 
    245 void psPolynomial2DFree(psPolynomial2D *myPoly)
     256}
     257
     258static void polynomial2DFree(psPolynomial2D *myPoly)
    246259{
    247260    int x = 0;
     
    255268    psFree(myPoly->coeffErr);
    256269    psFree(myPoly->mask);
    257 
    258     psFree(myPoly);
    259 }
    260 
    261 void psPolynomial3DFree(psPolynomial3D *myPoly)
     270}
     271
     272static void polynomial3DFree(psPolynomial3D *myPoly)
    262273{
    263274    int x = 0;
     
    278289    psFree(myPoly->coeffErr);
    279290    psFree(myPoly->mask);
    280     psFree(myPoly);
    281 }
    282 
    283 void psPolynomial4DFree(psPolynomial4D *myPoly)
     291}
     292
     293static void polynomial4DFree(psPolynomial4D *myPoly)
    284294{
    285295    int w = 0;
     
    306316    psFree(myPoly->coeffErr);
    307317    psFree(myPoly->mask);
    308     psFree(myPoly);
    309318}
    310319
     
    434443
    435444    newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
     445    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree);
    436446    newPoly->n = n;
    437447    newPoly->coeff    = (double *) psAlloc(n * sizeof(double));
     
    454464
    455465    newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
     466    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree);
    456467    newPoly->nX = nX;
    457468    newPoly->nY = nY;
     
    484495
    485496    newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
     497    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree);
    486498    newPoly->nX = nX;
    487499    newPoly->nY = nY;
     
    523535
    524536    newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
     537    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree);
    525538    newPoly->nW = nW;
    526539    newPoly->nX = nX;
     
    561574}
    562575
    563 void psDPolynomial1DFree(psDPolynomial1D *myPoly)
     576static void dPolynomial1DFree(psDPolynomial1D *myPoly)
    564577{
    565578    psFree(myPoly->coeff);
    566579    psFree(myPoly->coeffErr);
    567580    psFree(myPoly->mask);
    568     psFree(myPoly);
    569 }
    570 
    571 void psDPolynomial2DFree(psDPolynomial2D *myPoly)
     581}
     582
     583static void dPolynomial2DFree(psDPolynomial2D *myPoly)
    572584{
    573585    int x = 0;
     
    581593    psFree(myPoly->coeffErr);
    582594    psFree(myPoly->mask);
    583 
    584     psFree(myPoly);
    585 }
    586 
    587 void psDPolynomial3DFree(psDPolynomial3D *myPoly)
     595}
     596
     597static void dPolynomial3DFree(psDPolynomial3D *myPoly)
    588598{
    589599    int x = 0;
     
    604614    psFree(myPoly->coeffErr);
    605615    psFree(myPoly->mask);
    606     psFree(myPoly);
    607 }
    608 
    609 void psDPolynomial4DFree(psDPolynomial4D *myPoly)
     616}
     617
     618static void dPolynomial4DFree(psDPolynomial4D *myPoly)
    610619{
    611620    int w = 0;
     
    632641    psFree(myPoly->coeffErr);
    633642    psFree(myPoly->mask);
    634     psFree(myPoly);
    635643}
    636644
  • trunk/psLib/src/math/psPolynomial.h

    r1020 r1073  
    1212 *  @author George Gusciora, MHPCC
    1313 *
    14  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-06-14 19:32:42 $
     14 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-06-23 23:00:15 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    104104                                   );
    105105
    106 /** Destructor */
    107 void psPolynomial1DFree(psPolynomial1D *myPoly ///< Polynomial to destroy
    108                        );
    109 
    110 /** Destructor */
    111 void psPolynomial2DFree(psPolynomial2D *myPoly ///< Polynomial to destroy
    112                        );
    113 /** Destructor */
    114 void psPolynomial3DFree(psPolynomial3D *myPoly ///< Polynomial to destroy
    115                        );
    116 /** Destructor */
    117 void psPolynomial4DFree(psPolynomial4D *myPoly ///< Polynomial to destroy
    118                        );
    119 
    120 
    121106/** Evaluate 1D polynomial */
    122107float
     
    206191                                     );
    207192
    208 
    209 /** Destructor */
    210 void psDPolynomial1DFree(psDPolynomial1D *myPoly ///< Polynomial to destroy
    211                         );
    212 /** Destructor */
    213 void psDPolynomial2DFree(psDPolynomial2D *myPoly ///< Polynomial to destroy
    214                         );
    215 /** Destructor */
    216 void psDPolynomial3DFree(psDPolynomial3D *myPoly ///< Polynomial to destroy
    217                         );
    218 /** Destructor */
    219 void psDPolynomial4DFree(psDPolynomial4D *myPoly ///< Polynomial to destroy
    220                         );
    221 
    222 
    223193/** Evaluate 1D polynomial (double precision) */
    224194double
  • trunk/psLib/src/math/psSpline.c

    r1022 r1073  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-06-14 19:40:14 $
     9 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-06-23 23:00:15 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434#include <gsl/gsl_rng.h>
    3535#include <gsl/gsl_randist.h>
     36
     37static void polynomial1DFree(psPolynomial1D *myPoly);
     38static void polynomial2DFree(psPolynomial2D *myPoly);
     39static void polynomial3DFree(psPolynomial3D *myPoly);
     40static void polynomial4DFree(psPolynomial4D *myPoly);
     41static void dPolynomial1DFree(psDPolynomial1D *myPoly);
     42static void dPolynomial2DFree(psDPolynomial2D *myPoly);
     43static void dPolynomial3DFree(psDPolynomial3D *myPoly);
     44static void dPolynomial4DFree(psDPolynomial4D *myPoly);
     45
    3646/*****************************************************************************/
    3747/*  FUNCTION IMPLEMENTATION - PUBLIC                                         */
     
    108118
    109119    newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
     120    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree);
    110121    newPoly->n = n;
    111122    newPoly->coeff    = (float *) psAlloc(n * sizeof(float));
     
    128139
    129140    newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
     141    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree);
    130142    newPoly->nX = nX;
    131143    newPoly->nY = nY;
     
    158170
    159171    newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
     172    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree);
    160173    newPoly->nX = nX;
    161174    newPoly->nY = nY;
     
    197210
    198211    newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
     212    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree);
    199213    newPoly->nW = nW;
    200214    newPoly->nX = nX;
     
    235249}
    236250
    237 void psPolynomial1DFree(psPolynomial1D *myPoly)
     251static void polynomial1DFree(psPolynomial1D *myPoly)
    238252{
    239253    psFree(myPoly->coeff);
    240254    psFree(myPoly->coeffErr);
    241255    psFree(myPoly->mask);
    242     psFree(myPoly);
    243 }
    244 
    245 void psPolynomial2DFree(psPolynomial2D *myPoly)
     256}
     257
     258static void polynomial2DFree(psPolynomial2D *myPoly)
    246259{
    247260    int x = 0;
     
    255268    psFree(myPoly->coeffErr);
    256269    psFree(myPoly->mask);
    257 
    258     psFree(myPoly);
    259 }
    260 
    261 void psPolynomial3DFree(psPolynomial3D *myPoly)
     270}
     271
     272static void polynomial3DFree(psPolynomial3D *myPoly)
    262273{
    263274    int x = 0;
     
    278289    psFree(myPoly->coeffErr);
    279290    psFree(myPoly->mask);
    280     psFree(myPoly);
    281 }
    282 
    283 void psPolynomial4DFree(psPolynomial4D *myPoly)
     291}
     292
     293static void polynomial4DFree(psPolynomial4D *myPoly)
    284294{
    285295    int w = 0;
     
    306316    psFree(myPoly->coeffErr);
    307317    psFree(myPoly->mask);
    308     psFree(myPoly);
    309318}
    310319
     
    434443
    435444    newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
     445    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree);
    436446    newPoly->n = n;
    437447    newPoly->coeff    = (double *) psAlloc(n * sizeof(double));
     
    454464
    455465    newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
     466    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree);
    456467    newPoly->nX = nX;
    457468    newPoly->nY = nY;
     
    484495
    485496    newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
     497    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree);
    486498    newPoly->nX = nX;
    487499    newPoly->nY = nY;
     
    523535
    524536    newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
     537    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree);
    525538    newPoly->nW = nW;
    526539    newPoly->nX = nX;
     
    561574}
    562575
    563 void psDPolynomial1DFree(psDPolynomial1D *myPoly)
     576static void dPolynomial1DFree(psDPolynomial1D *myPoly)
    564577{
    565578    psFree(myPoly->coeff);
    566579    psFree(myPoly->coeffErr);
    567580    psFree(myPoly->mask);
    568     psFree(myPoly);
    569 }
    570 
    571 void psDPolynomial2DFree(psDPolynomial2D *myPoly)
     581}
     582
     583static void dPolynomial2DFree(psDPolynomial2D *myPoly)
    572584{
    573585    int x = 0;
     
    581593    psFree(myPoly->coeffErr);
    582594    psFree(myPoly->mask);
    583 
    584     psFree(myPoly);
    585 }
    586 
    587 void psDPolynomial3DFree(psDPolynomial3D *myPoly)
     595}
     596
     597static void dPolynomial3DFree(psDPolynomial3D *myPoly)
    588598{
    589599    int x = 0;
     
    604614    psFree(myPoly->coeffErr);
    605615    psFree(myPoly->mask);
    606     psFree(myPoly);
    607 }
    608 
    609 void psDPolynomial4DFree(psDPolynomial4D *myPoly)
     616}
     617
     618static void dPolynomial4DFree(psDPolynomial4D *myPoly)
    610619{
    611620    int w = 0;
     
    632641    psFree(myPoly->coeffErr);
    633642    psFree(myPoly->mask);
    634     psFree(myPoly);
    635643}
    636644
  • trunk/psLib/src/math/psSpline.h

    r1020 r1073  
    1212 *  @author George Gusciora, MHPCC
    1313 *
    14  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-06-14 19:32:42 $
     14 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-06-23 23:00:15 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    104104                                   );
    105105
    106 /** Destructor */
    107 void psPolynomial1DFree(psPolynomial1D *myPoly ///< Polynomial to destroy
    108                        );
    109 
    110 /** Destructor */
    111 void psPolynomial2DFree(psPolynomial2D *myPoly ///< Polynomial to destroy
    112                        );
    113 /** Destructor */
    114 void psPolynomial3DFree(psPolynomial3D *myPoly ///< Polynomial to destroy
    115                        );
    116 /** Destructor */
    117 void psPolynomial4DFree(psPolynomial4D *myPoly ///< Polynomial to destroy
    118                        );
    119 
    120 
    121106/** Evaluate 1D polynomial */
    122107float
     
    206191                                     );
    207192
    208 
    209 /** Destructor */
    210 void psDPolynomial1DFree(psDPolynomial1D *myPoly ///< Polynomial to destroy
    211                         );
    212 /** Destructor */
    213 void psDPolynomial2DFree(psDPolynomial2D *myPoly ///< Polynomial to destroy
    214                         );
    215 /** Destructor */
    216 void psDPolynomial3DFree(psDPolynomial3D *myPoly ///< Polynomial to destroy
    217                         );
    218 /** Destructor */
    219 void psDPolynomial4DFree(psDPolynomial4D *myPoly ///< Polynomial to destroy
    220                         );
    221 
    222 
    223193/** Evaluate 1D polynomial (double precision) */
    224194double
  • trunk/psLib/src/math/psStats.c

    r1071 r1073  
    3232                           psStats *stats);
    3333#endif
     34
     35static void histogramFree(psHistogram *myHist);
    3436
    3537/******************************************************************************
     
    6870
    6971/******************************************************************************
    70     psStatsFree(): This routine must free the psStats data structure.
    71  *****************************************************************************/
    72 void psStatsFree(psStats *stats)
    73 {
    74     psFree(stats);
    75 }
    76 
    77 /******************************************************************************
    7872psHistogramAlloc(lower, upper, n): allocate a uniform histogram structure
    7973with the specifed upper and lower limits, and the specifed number of bins.
     
    108102    // bins, then there are N+1 bounds to those bins.
    109103    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     104    p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree);
    110105    newHist->bounds = psVectorAlloc(n+1, PS_TYPE_F32);
    111106    newHist->bounds->n = newHist->bounds->nalloc;
     
    160155    // Allocate memory for the new histogram structure.
    161156    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     157    p_psMemSetDeallocator(newHist,(psFreeFcn)histogramFree);
    162158    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
    163159    newHist->bounds->n = newHist->bounds->nalloc;
     
    182178}
    183179
    184 void psHistogramFree(psHistogram *myHist)
    185 {
    186     psVectorFree(myHist->bounds);
    187     psVectorFree(myHist->nums);
    188     psFree(myHist);
     180static void histogramFree(psHistogram *myHist)
     181{
     182    psFree(myHist->bounds);
     183    psFree(myHist->nums);
    189184}
    190185
     
    618613
    619614        // Free temporary data buffers.
    620         psStatsFree(stats2);
     615        psFree(stats2);
    621616
    622617        // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure.
     
    688683
    689684    // Free the temporary data structures.
    690     psVectorFree(unsortedVector);
    691     psVectorFree(sortedVector);
     685    psFree(unsortedVector);
     686    psFree(sortedVector);
    692687}
    693688
     
    775770
    776771        // Free temporary data buffers.
    777         psStatsFree(stats2);
     772        psFree(stats2);
    778773
    779774        // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure.
     
    840835
    841836    // Free the temporary data structures.
    842     psVectorFree(unsortedVector);
    843     psVectorFree(sortedVector);
     837    psFree(unsortedVector);
     838    psFree(sortedVector);
    844839    // NOTE: This is the
    845840}
     
    10431038    }
    10441039
    1045     psVectorFree(tmpMask);
     1040    psFree(tmpMask);
    10461041}
    10471042
     
    11251120            stats->robustLQ = stats->clippedMean;
    11261121        }
    1127         psStatsFree(tmpStats);
    1128         psHistogramFree(robustHistogram);
     1122        psFree(tmpStats);
     1123        psFree(robustHistogram);
    11291124        return;
    11301125    }
     
    12001195    stats->robustNfit = 0.0;
    12011196    stats->robustN50 = 0.0;
    1202     psStatsFree(tmpStats);
    1203     psHistogramFree(robustHistogram);
     1197    psFree(tmpStats);
     1198    psFree(robustHistogram);
    12041199}
    12051200
  • trunk/psLib/src/math/psStats.h

    r1020 r1073  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-06-14 19:33:09 $
     11 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-06-23 23:00:15 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8888psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure
    8989
    90 /** A destructor for the stats structure.*/
    91 void psStatsFree(psStats *restrict stats); ///< Stats structure to destroy
    92 
    9390/******************************************************************************
    9491    Histogram functions and data structures.
     
    116113psHistogram * psHistogramAllocGeneric(const psVector *restrict bounds); ///< Bounds for the bins
    117114
    118 
    119 /** Destructor \ingroup MathGroup **/
    120 void psHistogramFree(psHistogram *myHist);          ///< Histogram to destroy
    121 
    122 
    123115/** Calculate a histogram \ingroup MathGroup **/
    124116psHistogram *psHistogramVector (psHistogram *out,   ///< Histogram data
  • trunk/psLib/src/mathtypes/psImage.c

    r996 r1073  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-06-11 02:02:53 $
     11 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-06-23 23:00:15 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828#include "psImage.h"
    2929
     30static void imageFree(psImage* image);
    3031
    3132/*****************************************************************************/
     
    4950
    5051    psImage *image = (psImage *)psAlloc(sizeof(psImage));
     52    p_psMemSetDeallocator(image,(psFreeFcn)imageFree);
    5153
    5254    image->data.V = psAlloc(sizeof(void*)*numRows);
     
    7173}
    7274
    73 void psImageFree(psImage *image)
     75static void imageFree(psImage* image)
    7476{
    7577    if (image == NULL) {
     
    9698    psFree(image->data.V);
    9799    image->data.V = NULL;
    98 
    99     psFree(image);
    100100}
    101101
     
    237237        if (children[i] != NULL) {
    238238            numFreed++;
    239             psImageFree(children[i]);
     239            psFree(children[i]);
    240240        }
    241241    }
     
    341341    case PS_TYPE_PTR: \
    342342        psError(__func__,"Can't copy image from a matrix of pointers."); \
    343         psImageFree(output); \
     343        psFree(output); \
    344344        return NULL; \
    345345    default: \
     
    391391    case PS_TYPE_PTR:
    392392        psError(__func__,"Can't copy image into a matrix of pointers.");
    393         psImageFree(output);
     393        psFree(output);
    394394        return NULL;
    395395    }
     
    534534        case PS_TYPE_PTR:
    535535            psError (__func__, "Can't copy image from a matrix of pointers.");
    536             psImageFree (output);
     536            psFree (output);
    537537            return ((void *) 0);
    538538        default:
     
    676676        case PS_TYPE_PTR:
    677677            psError (__func__, "Can't copy image from a matrix of pointers.");
    678             psImageFree (output);
     678            psFree (output);
    679679            return ((void *) 0);
    680680        default:
     
    818818        case PS_TYPE_PTR:
    819819            psError (__func__, "Can't copy image from a matrix of pointers.");
    820             psImageFree (output);
     820            psFree (output);
    821821            return ((void *) 0);
    822822        default:
     
    960960        case PS_TYPE_PTR:
    961961            psError (__func__, "Can't copy image from a matrix of pointers.");
    962             psImageFree (output);
     962            psFree (output);
    963963            return ((void *) 0);
    964964        default:
     
    11021102        case PS_TYPE_PTR:
    11031103            psError (__func__, "Can't copy image from a matrix of pointers.");
    1104             psImageFree (output);
     1104            psFree (output);
    11051105            return ((void *) 0);
    11061106        default:
     
    12441244        case PS_TYPE_PTR:
    12451245            psError (__func__, "Can't copy image from a matrix of pointers.");
    1246             psImageFree (output);
     1246            psFree (output);
    12471247            return ((void *) 0);
    12481248        default:
     
    13861386        case PS_TYPE_PTR:
    13871387            psError (__func__, "Can't copy image from a matrix of pointers.");
    1388             psImageFree (output);
     1388            psFree (output);
    13891389            return ((void *) 0);
    13901390        default:
     
    15281528        case PS_TYPE_PTR:
    15291529            psError (__func__, "Can't copy image from a matrix of pointers.");
    1530             psImageFree (output);
     1530            psFree (output);
    15311531            return ((void *) 0);
    15321532        default:
     
    16701670        case PS_TYPE_PTR:
    16711671            psError (__func__, "Can't copy image from a matrix of pointers.");
    1672             psImageFree (output);
     1672            psFree (output);
    16731673            return ((void *) 0);
    16741674        default:
     
    18121812        case PS_TYPE_PTR:
    18131813            psError (__func__, "Can't copy image from a matrix of pointers.");
    1814             psImageFree (output);
     1814            psFree (output);
    18151815            return ((void *) 0);
    18161816        default:
     
    19541954        case PS_TYPE_PTR:
    19551955            psError (__func__, "Can't copy image from a matrix of pointers.");
    1956             psImageFree (output);
     1956            psFree (output);
    19571957            return ((void *) 0);
    19581958        default:
     
    20962096        case PS_TYPE_PTR:
    20972097            psError (__func__, "Can't copy image from a matrix of pointers.");
    2098             psImageFree (output);
     2098            psFree (output);
    20992099            return ((void *) 0);
    21002100        default:
     
    21042104    case PS_TYPE_PTR:
    21052105        psError (__func__, "Can't copy image into a matrix of pointers.");
    2106         psImageFree (output);
     2106        psFree (output);
    21072107        return ((void *) 0);
    21082108    }
  • trunk/psLib/src/mathtypes/psImage.h

    r974 r1073  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-06-10 01:58:06 $
     13 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-06-23 23:00:15 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    110110);
    111111
    112 /** Destroy the specified image.
    113  *
    114  *  Uses psLib memory deallocation functions to free an image and any existing
    115  *  children.
    116  *
    117  */
    118 void psImageFree(
    119     psImage *restrict image             ///< Free psImage
    120 );
    121 
    122112/** Frees all children of a psImage.
    123113 *
  • trunk/psLib/src/mathtypes/psVector.c

    r1008 r1073  
    88 *  @author Ross Harman, MHPCC
    99 *
    10  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-06-12 01:33:16 $
     10 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-06-23 23:00:15 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4949/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
    5050/*****************************************************************************/
     51static void vectorFree(psVector *restrict psVec);
    5152
    5253/*****************************************************************************/
     
    6869    // Create vector struct
    6970    psVec = (psVector *)psAlloc(sizeof(psVector));
     71    p_psMemSetDeallocator(psVec,(psFreeFcn)vectorFree);
    7072
    7173    psVec->type.dimen = PS_DIMEN_VECTOR;
     
    132134    if(nalloc < 1) {
    133135        psError(__func__, "Invalid value for nalloc (%d)\n", nalloc);
    134         psVectorFree(in);
     136        psFree(in);
    135137        return NULL;
    136138    }
     
    154156}
    155157
    156 void psVectorFree(psVector *restrict psVec)
     158static void vectorFree(psVector *restrict psVec)
    157159{
    158160    if (psVec == NULL) {
     
    160162    }
    161163
     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
    162171    psFree(psVec->data.V);
    163     psFree(psVec);
    164172}
    165173
    166 void psVectorElementFree(psVector *restrict psVec, void (*elemFree)(void *))
     174void psVectorElementFree(psVector *restrict psVec)
    167175{
    168176
     
    176184    }
    177185
    178     for(int i = 0; i < psVec->nalloc; i++) {
    179         if(elemFree == NULL) {
    180             psMemDecrRefCounter(psVec->data.PTR[i]);
    181         } else {
    182             elemFree(psMemDecrRefCounter(psVec->data.PTR[i]));
    183         }
     186    for(int i = 0; i < psVec->n; i++) {
     187        psFree(psVec->data.PTR[i]);
    184188        psVec->data.PTR[i] = NULL;
    185189    }
  • trunk/psLib/src/mathtypes/psVector.h

    r974 r1073  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-06-10 01:58:06 $
     13 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-06-23 23:00:15 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    100100);
    101101
    102 /** Deallocate a vector.
    103  *
    104  * Uses psLib memory allocation functions to deallocate a vector collection of data. The vector is deallocated
    105  * according to the psType type member contained within the vector.
    106  *
    107  * @return psVector*: Pointer to psVector.
    108  *
    109  */
    110 void psVectorFree(
    111     psVector *restrict psVec  ///< Vector to free.
    112 );
    113 
    114 
    115102/** Deallocate/Dereference elements of a void pointer vector.
    116103 *
     
    122109 */
    123110void psVectorElementFree(
    124     psVector *restrict psVec,   ///< Void pointer vector to destroy.
    125     void (*elemFree)(void *)    ///< Optional callback function to remove vector elements.
     111    psVector *restrict psVec    ///< Void pointer vector to destroy.
    126112);
    127113
  • trunk/psLib/src/sys/psMemory.c

    r876 r1073  
    88 *  @author Robert Lupton, Princeton University
    99 *
    10  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-06-04 23:46:48 $
     10 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-06-23 23:00:15 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3030static int checkMemBlock(const psMemBlock *m, const char* funcName);
    3131static psMemBlock *lastMemBlockAllocated = NULL;
    32 pthread_mutex_t  memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
    33 pthread_mutex_t  memIdMutex = PTHREAD_MUTEX_INITIALIZER;
     32static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
     33static pthread_mutex_t memIdMutex = PTHREAD_MUTEX_INITIALIZER;
    3434
    3535/**
     
    9696psMemoryId p_psMemFreeID = 0;   // notify user this block is freed
    9797
    98 psMemoryId psMemAllocateCallbackSetID(psMemoryId id) // set p_psMemAllocateID to id
     98psMemoryId psMemAllocateCallbackSetID(psMemoryId id)
    9999{
    100100    psMemoryId old = p_psMemAllocateID;
     
    104104}
    105105
    106 psMemoryId psMemFreeCallbackSetID(psMemoryId id)  // set p_psMemFreeID to id
     106psMemoryId psMemFreeCallbackSetID(psMemoryId id)
    107107{
    108108    psMemoryId old = p_psMemFreeID;
     
    184184#define ALIGNED(P) ((void *)((long)(P) & ~03) == (P))
    185185
    186 static int
    187 checkMemBlock(const psMemBlock *m,
    188               const char* funcName)
     186static int checkMemBlock(const psMemBlock *m, const char* funcName)
    189187{
    190188    // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     
    260258
    261259    ptr->file = file;
     260    ptr->freeFcn = NULL;
    262261    *(unsigned int*)&ptr->lineno = lineno;
    263262    ptr->startblock = P_PS_MEMMAGIC;
     
    346345    if (checkMemBlock(ptr, __func__) != 0) {
    347346        memProblemCallback(ptr, file, lineno); // we may not own this block; don't free it
    348     }
    349 
    350     psMemDecrRefCounter(vptr);          // this handles the free, if required.
     347        return;
     348    }
     349
     350    (void)psMemDecrRefCounter(vptr);   // this handles the free, if required.
    351351}
    352352
     
    354354 * Check for memory leaks. Not production quality code
    355355 */
    356 int psMemCheckLeaks(
    357     psMemoryId id0,                     // don't list blocks with id < id0
    358     psMemBlock ***arr,                  // pointer to array of pointers to leaked blocks, or NULL
    359     FILE *fd)                           // print list of leaks to fd (or NULL)
     356int psMemCheckLeaks(psMemoryId id0,psMemBlock ***arr,FILE *fd)
    360357{
    361358    int nleak = 0;
     
    365362    pthread_mutex_lock(&memBlockListMutex);
    366363
    367     for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock)
    368     {
     364    for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) {
    369365        if ( (psMemGetRefCounter(iter+1) > 0) && (iter->id >= id0) ) {
    370366            nleak++;
     
    382378    pthread_mutex_unlock(&memBlockListMutex);
    383379
    384     if (nleak == 0 || arr == NULL)
    385     {
     380    if (nleak == 0 || arr == NULL) {
    386381        return nleak;
    387382    }
     
    390385    pthread_mutex_lock(&memBlockListMutex);
    391386
    392     for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock)
    393     {
     387    for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) {
    394388        if ( (psMemGetRefCounter(iter+1) > 0) && (iter->id >= id0) ) {
    395389            (*arr)[j++] = iter;
     
    408402 * Reference counting APIs
    409403 */
    410 psReferenceCount psMemGetRefCounter(void *vptr) // return refCounter
     404// return refCounter
     405psReferenceCount psMemGetRefCounter(void *vptr)
    411406{
    412407    psMemBlock *ptr;
    413408    unsigned int refCount;
    414409
    415     if (vptr == NULL)
    416     {
     410    if (vptr == NULL) {
    417411        return 0;
    418412    }
     
    420414    ptr = ((psMemBlock *)vptr) - 1;
    421415
    422     if (checkMemBlock(ptr, __func__) != 0)
    423     {
     416    if (checkMemBlock(ptr, __func__) != 0) {
    424417        memProblemCallback(ptr, __func__, __LINE__);
    425418    }
     
    431424    return refCount;
    432425}
    433 
    434 void *psMemIncrRefCounter(void *vptr) // increment and return refCounter
     426// increment and return refCounter
     427void *psMemIncrRefCounter(void *vptr)
    435428{
    436429    psMemBlock *ptr;
    437430
    438     if (vptr == NULL)
    439     {
     431    if (vptr == NULL) {
    440432        return vptr;
    441433    }
     
    443435    ptr = ((psMemBlock *)vptr) - 1;
    444436
    445     if (checkMemBlock(ptr, __func__))
    446     {
     437    if (checkMemBlock(ptr, __func__)) {
    447438        memProblemCallback(ptr, __func__, __LINE__);
    448439    }
     
    455446}
    456447
    457 void *psMemDecrRefCounter(void *vptr) // decrement and return refCounter
    458 {
    459     if (vptr == NULL)
    460     {
     448// decrement and return refCounter
     449void *psMemDecrRefCounter(void *vptr)
     450{
     451    if (vptr == NULL) {
    461452        return NULL;
    462453    }
     
    467458    pthread_mutex_lock(&ptr->refCounterMutex);
    468459
    469     if (ptr->refCounter > 1)
    470     {
     460    if (ptr->refCounter > 1) {
    471461        /// XXX - Probably should have another mutex here.
    472462        ptr->refCounter--;          // multiple references, just decrement the count.
    473463        pthread_mutex_unlock(&ptr->refCounterMutex);
    474464
    475     } else
    476     {
     465    } else {
    477466        pthread_mutex_unlock(&ptr->refCounterMutex);
    478467
     
    482471        }
    483472
     473        if (ptr->freeFcn != NULL) {
     474            ptr->freeFcn(vptr);
     475        }
     476
    484477        pthread_mutex_lock(&memBlockListMutex);
    485478
     
    507500}
    508501
    509 void p_psCustomFree(psFreeFcn fcn, void* ptr)
    510 {
    511 
    512     if (fcn == NULL) {
     502void p_psMemSetDeallocator(void* vptr, psFreeFcn freeFcn)
     503{
     504    if (vptr == NULL) {
    513505        return;
    514     } else {
    515         if (fcn == PS_FREE) {
    516             psFree(ptr);
    517         } else {
    518             fcn(ptr);
    519         }
    520     }
    521 }
     506    }
     507
     508    psMemBlock *ptr = ((psMemBlock *)vptr) - 1;
     509
     510    ptr->freeFcn = freeFcn;
     511
     512}
     513psFreeFcn p_psMemGetDeallocator(void* vptr)
     514{
     515    if (vptr == NULL) {
     516        return NULL;
     517    }
     518
     519    psMemBlock *ptr = ((psMemBlock *)vptr) - 1;
     520
     521    return ptr->freeFcn;
     522}
  • trunk/psLib/src/sys/psMemory.h

    r978 r1073  
    1414 *  @ingroup MemoryManagement
    1515 *
    16  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2004-06-10 02:09:57 $
     16 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2004-06-23 23:00:15 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050/// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
    5151typedef unsigned long psReferenceCount;
     52
     53/// typedef for deallocator.
     54typedef void (*psFreeFcn)(void* ptr);
    5255
    5356/** Book-keeping data for storage allocator.
     
    5861typedef struct psMemBlock
    5962{
    60     const void* startblock;             ///< initialised to p_psMEMMAGIC
    61     struct psMemBlock* previousBlock;   ///< previous block in allocation list
    62     struct psMemBlock* nextBlock;       ///< next block allocation list
    63     size_t  userMemorySize;             ///< the size of the user-portion of the memory block
    64     const psMemoryId id;                ///< a unique ID for this allocation
    65     const char* file;                   ///< set from __FILE__ in e.g. p_psAlloc
    66     const int lineno;                   ///< set from __LINE__ in e.g. p_psAlloc
    67     pthread_mutex_t   refCounterMutex;  ///< mutex to ensure exclusive access to reference counter
    68     psReferenceCount refCounter;        ///< how many times pointer is referenced
    69     const void* endblock;               ///< initialised to p_psMEMMAGIC
     63    const void* startblock;            ///< initialised to p_psMEMMAGIC
     64    struct psMemBlock* previousBlock;  ///< previous block in allocation list
     65    struct psMemBlock* nextBlock;      ///< next block allocation list
     66    psFreeFcn freeFcn;                 ///< deallocator.  If NULL, use generic deallocation.
     67    size_t  userMemorySize;            ///< the size of the user-portion of the memory block
     68    const psMemoryId id;               ///< a unique ID for this allocation
     69    const char* file;                  ///< set from __FILE__ in e.g. p_psAlloc
     70    const int lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
     71    pthread_mutex_t   refCounterMutex; ///< mutex to ensure exclusive access to reference counter
     72    psReferenceCount refCounter;       ///< how many times pointer is referenced
     73    const void* endblock;              ///< initialised to p_psMEMMAGIC
    7074}
    7175psMemBlock;
     
    114118);
    115119
    116 typedef void (*psFreeFcn)(void* ptr);
    117 
    118120/** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
    119121 *
    120122 *  @return void* pointer to the allocated buffer. This will not be NULL.
    121  *  @see psFree
     123 *  @see psFree 
    122124 */
    123125#ifdef DOXYGEN
     
    131133    int lineno                      ///< Line number of call
    132134);
     135
     136void p_psMemSetDeallocator(void* ptr, psFreeFcn freeFcn);
     137psFreeFcn p_psMemGetDeallocator(void* ptr);
     138
    133139/// Memory allocation. psAlloc sends file and line number to p_psAlloc.
    134140#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
     
    282288);
    283289
    284 #define PS_FREE     (void*)1
    285 
    286290//@} End of Memory Management Functions
    287291
    288 
    289292#ifndef DOXYGEN
    290 
    291 void p_psCustomFree(psFreeFcn fcn,void* ptr);
    292293
    293294/*
  • trunk/psLib/src/sysUtils/psHash.c

    r964 r1073  
    1010 *  @author George Gusciora, MHPCC
    1111 *   
    12  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-06-10 00:09:55 $
     12 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <stdio.h>
    1919#include <string.h>
     20#include <stdbool.h>
    2021#include "psHash.h"
    2122#include "psMemory.h"
     
    2425#include "psAbort.h"
    2526
     27static psHashBucket *hashBucketAlloc(const char *key,void *data,psHashBucket *next);
     28static void hashBucketFree(psHashBucket *bucket);
     29static void *doHashWork(psHash* table, const char* key, void* data, bool remove
     30                           );
     31static void hashFree(psHash *table);
    2632
    2733/******************************************************************************
     
    8793    // Allocate memory for the new hash bucket.
    8894    psHashBucket *bucket = psAlloc(sizeof(psHashBucket));
     95    p_psMemSetDeallocator(bucket,(psFreeFcn)hashBucketFree);
    8996
    9097    // Initialize the bucket.
     
    105112
    106113/******************************************************************************
    107 hashBucketFree(bucket, itemFree): This procedure deallocates the specified
    108 hash bucket.  If "itemFree" is NULL, then we simply free the data with the
    109 standard psFree() function.  If "itemFree" is not NULL, then it must be a
    110 function pointer which takes the hash bucket as a parameter, and frees the
    111 data in that hash bucket.
     114hashBucketFree(bucket): This procedure deallocates the specified
     115hash bucket. 
    112116Inputs:
    113117    bucket: the hash bucket to be freed.
    114     itemFree: a function pointer, possibly NULL.
    115118Return:
    116119    NONE
    117120 *****************************************************************************/
    118 static void hashBucketFree(psHashBucket *bucket,   // bucket to free
    119                            void (*itemFree)(void *item)) // how to free data;
    120 {
    121     if (bucket == NULL)
    122     {
     121static void hashBucketFree(psHashBucket *bucket)
     122{
     123    if (bucket == NULL) {
    123124        return;
    124125    }
     
    126127    // A bucket is actually a linked list of buckets.  We recursively step
    127128    // through that linked list, free each bucket.
    128     if (bucket->next != NULL)
    129     {
    130         hashBucketFree(bucket, itemFree);
    131     }
     129    psFree(bucket->next);
    132130
    133131    psFree(bucket->key);
    134     psMemDecrRefCounter(bucket->data);
    135 
    136     if (itemFree != NULL)
    137     {
    138         itemFree(bucket->data);
    139     } else
    140     {
    141         psFree(bucket->data);
    142     }
    143 
    144     psFree(bucket);
     132
     133    psFree(bucket->data);
    145134}
    146135
     
    159148    // Create the new hash table.
    160149    psHash *table = psAlloc(sizeof(psHash));
     150    p_psMemSetDeallocator(table,(psFreeFcn)hashFree);
    161151
    162152    // Allocate memory for the buckets.
     
    185175Inputs:
    186176    table: a hash table
    187     itemFree: a function pointer, possibly NULL.
    188177Return:
    189178    NONE
    190179 *****************************************************************************/
    191 void psHashFree(psHash *table,  // hash table to be freed
    192                 void (*itemFree)(void *item)) // how to free hashed data; or NULL
     180static void hashFree(psHash *table)
    193181{
    194182    psHashBucket *tmp = NULL;           // Used to step through linked list.
     
    196184    int i = 0;                          // Loop index variable.
    197185
    198     if (table == NULL)
    199     {
     186    if (table == NULL) {
    200187        return;
    201188    }
     
    204191    // NULL, then free the bucket via a function call to hashBucketFree();
    205192
    206     for (i = 0; i < table->nbucket; i++)
    207     {
     193    for (i = 0; i < table->nbucket; i++) {
    208194        // A bucket is composed of a linked list of buckets.  We use the
    209195        // "tmp" and "ptr" pointers to step through that list and free each
     
    214200            while (ptr != NULL) {
    215201                tmp = ptr->next;
    216                 hashBucketFree(ptr, itemFree);
     202                psFree(ptr);
    217203                ptr = tmp;
    218204            }
     
    222208    // Free the bucket structure, then the hash table.
    223209    psFree(table->buckets);
    224     psFree(table);
    225 }
    226 
    227 /******************************************************************************
    228 doHashWork(table, key, data, remove, itemFree): This is an internal
     210}
     211
     212/******************************************************************************
     213doHashWork(table, key, data, remove): This is an internal
    229214procedure which does the bulk of the work in using the hash table.  Depending
    230215upon the input parameters, it will either insert a new key/data into the hash
    231216table, retrieve the data for a specified key, or remove a key/data item.  If
    232 we try to insert a key that already exists in the hash table, then we call
    233 the user-supplied function itemfree (or psFree if that is NULL), to free the
    234 existing data/key item.
     217we try to insert a key that already exists in the hash table, then we deallocate
     218the existing data/key item.
    235219Inputs:
    236220    table: a hash table
     
    238222    data: the data to insert, if not NULL
    239223    remove: set to non-zero if the key/data should be removed from the table.
    240     itemFree: function pointer
    241224Return:
    242225    NONE
     
    246229there is little common code between those functions.
    247230  *****************************************************************************/
    248 static void *doHashWork(psHash     *table,   // table to insert in
    249                         const char *key,     // key to use
    250                         void       *data,    // data to insert, or (if NULL) retrieve/remove
    251                         int remove
    252                             ,          // remove the item from the list?
    253                             void (*itemFree)(void *item)) // how to free hashed data
     231static void *doHashWork(psHash *table, const char *key, void *data, bool remove
     232                           )
    254233{
    255234    long int hash = 1;                  // This will contain an integer value
     
    313292                    }
    314293
    315                     psFree(ptr->key);
    316294                    psFree(ptr);
    317295
    318296                    // By definition, the data associated with that key
    319297                    // must be returned, not freed.
    320                     return psMemDecrRefCounter(data);
     298                    return data;
    321299                }
    322300                optr = ptr;
     
    354332                // the new data was not inserted into the hash table.
    355333
    356                 if (itemFree == NULL) {
    357                     psFree(psMemDecrRefCounter(ptr->data));
    358                 } else {
    359                     itemFree(psMemDecrRefCounter(ptr->data));
    360                 }
     334                psFree(ptr->data);
    361335
    362336                ptr->data = psMemIncrRefCounter(data);
     
    385359    NONE
    386360 *****************************************************************************/
    387 void *psHashInsert(psHash *table,   // table to insert in
    388                    const char *key, // key to use
    389                    void *data,      // data to insert
    390                    void (*itemFree)(void *item)) // how to free hashed data;
     361void *psHashInsert(psHash *table, const char *key, void *data)
    391362{
    392363    if (table == NULL) {
     
    400371    }
    401372
    402     return doHashWork(table, key, data, 0, itemFree);
     373    return doHashWork(table, key, data, 0);
    403374}
    404375
     
    425396
    426397
    427     return doHashWork(table, key, NULL, 0, NULL);
     398    return doHashWork(table, key, NULL, 0);
    428399}
    429400
     
    438409    The data that was associated with that key.
    439410 *****************************************************************************/
    440 void *psHashRemove(psHash *table,   // table to lookup key in
    441                    const char *key, // key to lookup
    442                    void (*itemFree)(void *item)) // how to free hashed data;
     411void *psHashRemove(psHash *table, const char *key)
    443412{
    444413    if (table == NULL) {
     
    449418    }
    450419
    451     return doHashWork(table, key, NULL, 1, itemFree);
    452 }
     420    return doHashWork(table, key, NULL, 1);
     421}
  • trunk/psLib/src/sysUtils/psHash.d

    r1041 r1073  
    11psHash.o psHash.d : psHash.c psHash.h ../collections/psList.h \
    2   ../collections/psVector.h ../collections/psType.h \
    3   ../sysUtils/psMemory.h psString.h psTrace.h psAbort.h
     2  ../collections/psVector.h ../collections/psType.h psMemory.h psString.h \
     3  psTrace.h psAbort.h
  • trunk/psLib/src/sysUtils/psHash.h

    r1013 r1073  
    1010 *  @author George Gusciora, MHPCC
    1111 *   
    12  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-06-12 05:50:01 $
     12 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4545                   );
    4646
    47 /// Free hash buckets from table.
    48 void psHashFree(psHash *table,               ///< hash table to be freed
    49                 void (*itemFree)(void *item) ///< how to free hashed data; or NULL
    50                );
    51 
    5247/// Insert entry into table.
    5348void *psHashInsert(psHash *table,               ///< table to insert in
    5449                   const char *key,             ///< key to use
    55                    void *data,                  ///< data to insert
    56                    void (*itemFree)(void *item) ///< how to free hashed data; or NULL
     50                   void *data                   ///< data to insert
    5751                  );
    5852
    5953/// Lookup key in table.
    60 void *psHashLookup(psHash *table, ///< table to lookup key in
    61                    const char *key ///< key to lookup
     54void *psHashLookup(psHash *table,      ///< table to lookup key in
     55                   const char *key     ///< key to lookup
    6256                  );
    6357
    6458/// Remove key from table.
    65 void *psHashRemove(psHash *table, ///< table to lookup key in
    66                    const char *key, ///< key to lookup
    67                    void (*itemFree)(void *item) ///< how to free hashed data; or NULL
     59void *psHashRemove(psHash *table,      ///< table to lookup key in
     60                   const char *key     ///< key to lookup
    6861                  );
    6962
  • trunk/psLib/src/sysUtils/psMemory.c

    r876 r1073  
    88 *  @author Robert Lupton, Princeton University
    99 *
    10  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-06-04 23:46:48 $
     10 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-06-23 23:00:15 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3030static int checkMemBlock(const psMemBlock *m, const char* funcName);
    3131static psMemBlock *lastMemBlockAllocated = NULL;
    32 pthread_mutex_t  memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
    33 pthread_mutex_t  memIdMutex = PTHREAD_MUTEX_INITIALIZER;
     32static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
     33static pthread_mutex_t memIdMutex = PTHREAD_MUTEX_INITIALIZER;
    3434
    3535/**
     
    9696psMemoryId p_psMemFreeID = 0;   // notify user this block is freed
    9797
    98 psMemoryId psMemAllocateCallbackSetID(psMemoryId id) // set p_psMemAllocateID to id
     98psMemoryId psMemAllocateCallbackSetID(psMemoryId id)
    9999{
    100100    psMemoryId old = p_psMemAllocateID;
     
    104104}
    105105
    106 psMemoryId psMemFreeCallbackSetID(psMemoryId id)  // set p_psMemFreeID to id
     106psMemoryId psMemFreeCallbackSetID(psMemoryId id)
    107107{
    108108    psMemoryId old = p_psMemFreeID;
     
    184184#define ALIGNED(P) ((void *)((long)(P) & ~03) == (P))
    185185
    186 static int
    187 checkMemBlock(const psMemBlock *m,
    188               const char* funcName)
     186static int checkMemBlock(const psMemBlock *m, const char* funcName)
    189187{
    190188    // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     
    260258
    261259    ptr->file = file;
     260    ptr->freeFcn = NULL;
    262261    *(unsigned int*)&ptr->lineno = lineno;
    263262    ptr->startblock = P_PS_MEMMAGIC;
     
    346345    if (checkMemBlock(ptr, __func__) != 0) {
    347346        memProblemCallback(ptr, file, lineno); // we may not own this block; don't free it
    348     }
    349 
    350     psMemDecrRefCounter(vptr);          // this handles the free, if required.
     347        return;
     348    }
     349
     350    (void)psMemDecrRefCounter(vptr);   // this handles the free, if required.
    351351}
    352352
     
    354354 * Check for memory leaks. Not production quality code
    355355 */
    356 int psMemCheckLeaks(
    357     psMemoryId id0,                     // don't list blocks with id < id0
    358     psMemBlock ***arr,                  // pointer to array of pointers to leaked blocks, or NULL
    359     FILE *fd)                           // print list of leaks to fd (or NULL)
     356int psMemCheckLeaks(psMemoryId id0,psMemBlock ***arr,FILE *fd)
    360357{
    361358    int nleak = 0;
     
    365362    pthread_mutex_lock(&memBlockListMutex);
    366363
    367     for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock)
    368     {
     364    for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) {
    369365        if ( (psMemGetRefCounter(iter+1) > 0) && (iter->id >= id0) ) {
    370366            nleak++;
     
    382378    pthread_mutex_unlock(&memBlockListMutex);
    383379
    384     if (nleak == 0 || arr == NULL)
    385     {
     380    if (nleak == 0 || arr == NULL) {
    386381        return nleak;
    387382    }
     
    390385    pthread_mutex_lock(&memBlockListMutex);
    391386
    392     for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock)
    393     {
     387    for (psMemBlock* iter = topBlock; iter != NULL; iter=iter->nextBlock) {
    394388        if ( (psMemGetRefCounter(iter+1) > 0) && (iter->id >= id0) ) {
    395389            (*arr)[j++] = iter;
     
    408402 * Reference counting APIs
    409403 */
    410 psReferenceCount psMemGetRefCounter(void *vptr) // return refCounter
     404// return refCounter
     405psReferenceCount psMemGetRefCounter(void *vptr)
    411406{
    412407    psMemBlock *ptr;
    413408    unsigned int refCount;
    414409
    415     if (vptr == NULL)
    416     {
     410    if (vptr == NULL) {
    417411        return 0;
    418412    }
     
    420414    ptr = ((psMemBlock *)vptr) - 1;
    421415
    422     if (checkMemBlock(ptr, __func__) != 0)
    423     {
     416    if (checkMemBlock(ptr, __func__) != 0) {
    424417        memProblemCallback(ptr, __func__, __LINE__);
    425418    }
     
    431424    return refCount;
    432425}
    433 
    434 void *psMemIncrRefCounter(void *vptr) // increment and return refCounter
     426// increment and return refCounter
     427void *psMemIncrRefCounter(void *vptr)
    435428{
    436429    psMemBlock *ptr;
    437430
    438     if (vptr == NULL)
    439     {
     431    if (vptr == NULL) {
    440432        return vptr;
    441433    }
     
    443435    ptr = ((psMemBlock *)vptr) - 1;
    444436
    445     if (checkMemBlock(ptr, __func__))
    446     {
     437    if (checkMemBlock(ptr, __func__)) {
    447438        memProblemCallback(ptr, __func__, __LINE__);
    448439    }
     
    455446}
    456447
    457 void *psMemDecrRefCounter(void *vptr) // decrement and return refCounter
    458 {
    459     if (vptr == NULL)
    460     {
     448// decrement and return refCounter
     449void *psMemDecrRefCounter(void *vptr)
     450{
     451    if (vptr == NULL) {
    461452        return NULL;
    462453    }
     
    467458    pthread_mutex_lock(&ptr->refCounterMutex);
    468459
    469     if (ptr->refCounter > 1)
    470     {
     460    if (ptr->refCounter > 1) {
    471461        /// XXX - Probably should have another mutex here.
    472462        ptr->refCounter--;          // multiple references, just decrement the count.
    473463        pthread_mutex_unlock(&ptr->refCounterMutex);
    474464
    475     } else
    476     {
     465    } else {
    477466        pthread_mutex_unlock(&ptr->refCounterMutex);
    478467
     
    482471        }
    483472
     473        if (ptr->freeFcn != NULL) {
     474            ptr->freeFcn(vptr);
     475        }
     476
    484477        pthread_mutex_lock(&memBlockListMutex);
    485478
     
    507500}
    508501
    509 void p_psCustomFree(psFreeFcn fcn, void* ptr)
    510 {
    511 
    512     if (fcn == NULL) {
     502void p_psMemSetDeallocator(void* vptr, psFreeFcn freeFcn)
     503{
     504    if (vptr == NULL) {
    513505        return;
    514     } else {
    515         if (fcn == PS_FREE) {
    516             psFree(ptr);
    517         } else {
    518             fcn(ptr);
    519         }
    520     }
    521 }
     506    }
     507
     508    psMemBlock *ptr = ((psMemBlock *)vptr) - 1;
     509
     510    ptr->freeFcn = freeFcn;
     511
     512}
     513psFreeFcn p_psMemGetDeallocator(void* vptr)
     514{
     515    if (vptr == NULL) {
     516        return NULL;
     517    }
     518
     519    psMemBlock *ptr = ((psMemBlock *)vptr) - 1;
     520
     521    return ptr->freeFcn;
     522}
  • trunk/psLib/src/sysUtils/psMemory.h

    r978 r1073  
    1414 *  @ingroup MemoryManagement
    1515 *
    16  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2004-06-10 02:09:57 $
     16 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2004-06-23 23:00:15 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050/// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
    5151typedef unsigned long psReferenceCount;
     52
     53/// typedef for deallocator.
     54typedef void (*psFreeFcn)(void* ptr);
    5255
    5356/** Book-keeping data for storage allocator.
     
    5861typedef struct psMemBlock
    5962{
    60     const void* startblock;             ///< initialised to p_psMEMMAGIC
    61     struct psMemBlock* previousBlock;   ///< previous block in allocation list
    62     struct psMemBlock* nextBlock;       ///< next block allocation list
    63     size_t  userMemorySize;             ///< the size of the user-portion of the memory block
    64     const psMemoryId id;                ///< a unique ID for this allocation
    65     const char* file;                   ///< set from __FILE__ in e.g. p_psAlloc
    66     const int lineno;                   ///< set from __LINE__ in e.g. p_psAlloc
    67     pthread_mutex_t   refCounterMutex;  ///< mutex to ensure exclusive access to reference counter
    68     psReferenceCount refCounter;        ///< how many times pointer is referenced
    69     const void* endblock;               ///< initialised to p_psMEMMAGIC
     63    const void* startblock;            ///< initialised to p_psMEMMAGIC
     64    struct psMemBlock* previousBlock;  ///< previous block in allocation list
     65    struct psMemBlock* nextBlock;      ///< next block allocation list
     66    psFreeFcn freeFcn;                 ///< deallocator.  If NULL, use generic deallocation.
     67    size_t  userMemorySize;            ///< the size of the user-portion of the memory block
     68    const psMemoryId id;               ///< a unique ID for this allocation
     69    const char* file;                  ///< set from __FILE__ in e.g. p_psAlloc
     70    const int lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
     71    pthread_mutex_t   refCounterMutex; ///< mutex to ensure exclusive access to reference counter
     72    psReferenceCount refCounter;       ///< how many times pointer is referenced
     73    const void* endblock;              ///< initialised to p_psMEMMAGIC
    7074}
    7175psMemBlock;
     
    114118);
    115119
    116 typedef void (*psFreeFcn)(void* ptr);
    117 
    118120/** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
    119121 *
    120122 *  @return void* pointer to the allocated buffer. This will not be NULL.
    121  *  @see psFree
     123 *  @see psFree 
    122124 */
    123125#ifdef DOXYGEN
     
    131133    int lineno                      ///< Line number of call
    132134);
     135
     136void p_psMemSetDeallocator(void* ptr, psFreeFcn freeFcn);
     137psFreeFcn p_psMemGetDeallocator(void* ptr);
     138
    133139/// Memory allocation. psAlloc sends file and line number to p_psAlloc.
    134140#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
     
    282288);
    283289
    284 #define PS_FREE     (void*)1
    285 
    286290//@} End of Memory Management Functions
    287291
    288 
    289292#ifndef DOXYGEN
    290 
    291 void p_psCustomFree(psFreeFcn fcn,void* ptr);
    292293
    293294/*
  • trunk/psLib/src/types/psBitSet.c

    r1041 r1073  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-06-15 02:45:43 $
     12 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5555/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
    5656/*****************************************************************************/
     57static void bitSetFree(psBitSet *restrict inBitSet);
     58
    5759
    5860/** Private function to create a mask.
     
    8890    numBytes = ceil(n/8.0);
    8991    newObj = psAlloc(sizeof(psBitSet));
     92    p_psMemSetDeallocator(newObj,(psFreeFcn)bitSetFree);
    9093    newObj->n = numBytes;
    9194
     
    98101}
    99102
    100 void psBitSetFree(psBitSet *restrict inBitSet)
     103static void bitSetFree(psBitSet *restrict inBitSet)
    101104{
    102105    if(inBitSet == NULL) {
     
    105108    }
    106109    psFree(inBitSet->bits);
    107     psFree(inBitSet);
    108110}
    109111
  • trunk/psLib/src/types/psBitSet.h

    r974 r1073  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-06-10 01:58:06 $
     14 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-06-23 23:00:15 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454psBitSet* psBitSetAlloc(
    5555    int n   /**< Number of bits in psBitSet array */
    56 );
    57 
    58 /** Free a psBitSet
    59  *
    60  *  Deletes a psBitSet array.
    61  */
    62 void psBitSetFree(
    63     psBitSet *restrict inMask  /**< Pointer to psBitSet to be deleted. */
    6456);
    6557
  • trunk/psLib/src/types/psList.c

    r1024 r1073  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-14 19:45:46 $
     8 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:15 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828
    2929// private functions.
    30 psListElem* listGetIterator(psList* list);
    31 int listGetIteratorIndex(psList* list);
    32 void listSetIterator(psList *list, int where, bool lockList);
     30static psListElem* listGetIterator(psList* list);
     31static int listGetIteratorIndex(psList* list);
     32static void listSetIterator(psList *list, int where, bool lockList);
     33static void listFree(psList *list);
    3334
    3435
     
    3637{
    3738    psList *list = psAlloc(sizeof(psList));
     39    p_psMemSetDeallocator(list,(psFreeFcn)listFree);
    3840
    3941    list->size = 0;
     
    4143    list->iter = ITER_INIT_HEAD;
    4244    list->iterIndex = PS_LIST_HEAD;
     45
    4346    pthread_mutex_init(&(list->lock),NULL)
    4447    ;
     
    5154}
    5255
    53 void psListFree(psList *list, psFreeFcn elemFree)
     56static void listFree(psList *list)
    5457{
    5558    if (list == NULL) {
     
    6366        psListElem *next = ptr->next;
    6467
    65         p_psCustomFree(elemFree, psMemDecrRefCounter(ptr->data));
     68        psFree(ptr->data);
    6669        psFree(ptr);
    6770
     
    7578    ;
    7679
    77     psFree(list);
    7880}
    7981
  • trunk/psLib/src/types/psList.h

    r1017 r1073  
    1010 *  @ingroup LinkedList
    1111 *
    12  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-06-12 22:15:39 $
     12 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7373)
    7474;
    75 
    76 #include "psMemory.h"
    77 /** Destroys a psList linked list object.  This also frees the elements of the
    78  *  list using the psFreeFcn given, if any.  If no psFreeFcn is specified,
    79  *  the elements are just dereferenced via psMemDecrRefCounter(...).
    80  *
    81  */
    82 void psListFree(
    83     psList* restrict list,              ///< list to destroy
    84     psFreeFcn elemFree                  ///< destructor for data on list
    85 );
    8675
    8776/** Adds an element to a psList at position given.
  • trunk/psLib/test/FullUnitTest

    r1035 r1073  
    1919#  RETURN : integer number of tests which failed
    2020#
    21 #  $Revision: 1.7 $  $Name: not supported by cvs2svn $
    22 #  $Date: 2004-06-15 00:19:42 $
     21#  $Revision: 1.8 $  $Name: not supported by cvs2svn $
     22#  $Date: 2004-06-23 23:00:15 $
    2323#
    2424#  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    302302            $retVal = $?;
    303303            # Count testpoints
    304             $totalPoints = `grep -c '***** TESTPOINT *****' temp/$files[$j].stdout`;
    305             $totalPoints += `grep -c '***** TESTPOINT *****' temp/$files[$j].stderr`;
     304            $testPattern = "\"\\*\\*\\*\\* TESTPOINT \\*\\*\\*\\*\"";
     305            $totalPoints = `grep -c $testPattern temp/$files[$j].stdout`;
     306            $totalPoints += `grep -c $testPattern temp/$files[$j].stderr`;
    306307            $failPoints = `grep "> TESTPOINT FAILED" temp/$files[$j].stdout | wc -l`;
    307308            $failPoints += `grep "> TESTPOINT FAILED" temp/$files[$j].stderr | wc -l`;
  • trunk/psLib/test/collections/builddir/tst_psBitSet_01.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psBitSet_02.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psBitSet_03.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psBitSet_04.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psBitSet_05.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psBitSet_06.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psImage.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h
  • trunk/psLib/test/collections/builddir/tst_psList.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h
  • trunk/psLib/test/collections/builddir/tst_psSort_01.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psSort_02.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psSort_03.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psSort_04.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psVector_01.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psVector_02.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/builddir/tst_psVector_03.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/collections/tst_psBitSet_01.c

    r965 r1073  
    1717 *  @author  Ross Harman, MHPCC
    1818 *
    19  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    20  *  @date  $Date: 2004-06-10 00:28:23 $
     19 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     20 *  @date  $Date: 2004-06-23 23:00:15 $
    2121 *
    2222 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    121121    // Test J - Free psBitSet
    122122    printPositiveTestHeader(stdout, "psBitSet", "Free psBitSet");
    123     psBitSetFree(bs);
     123    psFree(bs);
    124124    psMemCheckLeaks(0, NULL, stdout);
    125125    psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psBitSet_02.c

    r993 r1073  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-06-11 01:39:30 $
     12 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6363    // Test C - Free psBitSets
    6464    printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets");
    65     psBitSetFree(bs1);
    66     psBitSetFree(bs2);
    67     psBitSetFree(outbs);
     65    psFree(bs1);
     66    psFree(bs2);
     67    psFree(outbs);
    6868    psMemCheckLeaks(0, NULL, stdout);
    6969    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psBitSet_03.c

    r994 r1073  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-06-11 01:40:45 $
     12 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6363    // Test C - Free psBitSets
    6464    printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets");
    65     psBitSetFree(bs1);
    66     psBitSetFree(bs2);
    67     psBitSetFree(outbs);
     65    psFree(bs1);
     66    psFree(bs2);
     67    psFree(outbs);
    6868    psMemCheckLeaks(0, NULL, stdout);
    6969    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psBitSet_04.c

    r995 r1073  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-06-11 01:46:02 $
     12 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6363    // Test C - Free psBitSets
    6464    printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets");
    65     psBitSetFree(bs1);
    66     psBitSetFree(bs2);
    67     psBitSetFree(outbs);
     65    psFree(bs1);
     66    psFree(bs2);
     67    psFree(outbs);
    6868    psMemCheckLeaks(0, NULL, stdout);
    6969    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psBitSet_05.c

    r965 r1073  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-06-10 00:28:36 $
     12 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4848    // Test C - Free psBitSets
    4949    printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets");
    50     psBitSetFree(bs1);
    51     psBitSetFree(bs2);
    52     psBitSetFree(outbs);
     50    psFree(bs1);
     51    psFree(bs2);
     52    psFree(outbs);
    5353    psMemCheckLeaks(0, NULL, stdout);
    5454    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psBitSet_06.c

    r965 r1073  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-06-10 00:28:43 $
     14 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-06-23 23:00:15 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5555    printFooter(stdout, "psBitSet", "Create negative size bitset", true);
    5656
    57 
    58     // Test D - Attempt to free null BitSet
    59     printNegativeTestHeader(stdout,"psBitSet", "Attempt to free null BitSet",
    60                             "Null psBitSet for inBitSet argument", 0);
    61     psBitSetFree(NULL);
    62     printFooter(stdout, "psBitSet", "Attempt to free null BitSet", true);
    63 
    64 
    6557    // Test E - Free psBitSets
    6658    printPositiveTestHeader(stdout, "psBitSet", "Free psBitSets");
    67     psBitSetFree(bs1);
    68     psBitSetFree(bs2);
    69     psBitSetFree(outbs);
     59    psFree(bs1);
     60    psFree(bs2);
     61    psFree(outbs);
    7062    psMemCheckLeaks(0, NULL, stdout);
    7163    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psList.c

    r1033 r1073  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-14 23:03:43 $
     8 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:15 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7878    }
    7979
    80     psListFree(list,NULL);
     80    psFree(list);
    8181
    8282    list = psListAlloc(data);
     
    108108
    109109
    110     psListFree(list,PS_FREE);
     110    psFree(list);
     111
     112    psFree(data);
    111113
    112114    return 0;
     
    283285    }
    284286
    285     psListFree(list, PS_FREE);
     287    psFree(list);
    286288
    287289    return 0;
     
    339341    *data = 0;
    340342    list = psListAlloc(data);
     343    psFree(data);
    341344
    342345    data = psAlloc(sizeof(int));
    343346    *data = 1;
    344347    list = psListAdd(list,data,PS_LIST_TAIL);
     348    psFree(data);
    345349
    346350    data = psAlloc(sizeof(int));
    347351    *data = 2;
    348352    list = psListAdd(list,data,PS_LIST_TAIL);
     353    psFree(data);
    349354
    350355    data = psAlloc(sizeof(int));
    351356    *data = 3;
    352357    list = psListAdd(list,data,PS_LIST_TAIL);
     358    psFree(data);
    353359
    354360    //  2. which>0 and which<list.n.
     
    404410    }
    405411
    406     psListFree(list,PS_FREE);
     412    psFree(list);
    407413
    408414    return 0;
     
    637643    }
    638644
    639     psListFree(list,PS_FREE);
     645    psFree(list);
    640646
    641647    return 0;
     
    691697    }
    692698
    693     psVectorFree(vec);
    694     psListFree(list,PS_FREE);
     699    psFree(vec);
     700    psFree(list);
    695701
    696702    // test vector -> dlist
     
    729735    }
    730736
    731     psVectorFree(vec);
    732     psListFree(list,PS_FREE);
     737    psFree(vec);
     738    psFree(list);
    733739
    734740    // now, make sure if input vector/list is NULL, output is NULL
     
    755761        return 1;
    756762    }
    757     psVectorFree(vec);
    758     psListFree(list,PS_FREE);
     763    psFree(vec);
     764    psFree(list);
    759765
    760766    list = psListAlloc(NULL);
     
    765771        return 1;
    766772    }
    767     psVectorFree(vec);
    768     psListFree(list,PS_FREE);
     773    psFree(vec);
     774    psFree(list);
    769775
    770776    return 0;
     
    895901    }
    896902
    897     psListFree(list,PS_FREE);
     903    psFree(list);
    898904
    899905    return 0;
     
    938944    */
    939945
    940     psListFree(list,NULL);
     946    psFree(list);
    941947
    942948    /*
  • trunk/psLib/test/collections/tst_psSort_01.c

    r988 r1073  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-06-10 23:14:22 $
     12 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7171    // Test D - Free float vectors
    7272    printPositiveTestHeader(stdout,"psSort", "Free float vectors");
    73     psVectorFree(in);
    74     psVectorFree(out);
     73    psFree(in);
     74    psFree(out);
    7575    psMemCheckLeaks(0, NULL, stdout);
    7676    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psSort_02.c

    r831 r1073  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-06-02 23:29:29 $
     12 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5555    // Test C - Free vectors
    5656    printPositiveTestHeader(stdout,"psSort", "Free vectors");
    57     psVectorFree(in);
    58     psVectorFree(out);
     57    psFree(in);
     58    psFree(out);
    5959    psMemCheckLeaks(0, NULL, stdout);
    6060    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psSort_03.c

    r831 r1073  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-06-02 23:29:29 $
     12 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-23 23:00:15 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4949    // Test C - Free float vectors
    5050    printPositiveTestHeader(stdout,"psSort", "Free float vectors");
    51     psVectorFree(in);
    52     psVectorFree(out);
     51    psFree(in);
     52    psFree(out);
    5353    psMemCheckLeaks(0, NULL, stdout);
    5454    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psSort_04.c

    r988 r1073  
    99 *  @author  Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
    12  *  @date  $Date: 2004-06-10 23:14:22 $
     11 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
     12 *  @date  $Date: 2004-06-23 23:00:15 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333    // Test B - Free vectors
    3434    printPositiveTestHeader(stdout, "psSort", "Free vectors");
    35     psVectorFree(goodOut);
     35    psFree(goodOut);
    3636    psMemCheckLeaks(0, NULL, stdout);
    3737    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psVector_01.c

    r972 r1073  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2004-06-10 01:50:43 $
     16 *  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2004-06-23 23:00:15 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7979    // Test E - Free S32 vector
    8080    printPositiveTestHeader(stdout, "psVector", "Free S32 vector");
    81     psVectorFree(psVec);
     81    psFree(psVec);
    8282    psMemCheckLeaks(0, NULL, stdout);
    8383    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/collections/tst_psVector_02.c

    r831 r1073  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-06-02 23:29:29 $
     14 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-06-23 23:00:15 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    102102    // Test E - Free void pointer vector
    103103    printPositiveTestHeader(stdout, "psVector", "Free void pointer vector");
    104     psVectorElementFree(psVec, NULL);
    105     psVectorFree(psVec);
     104    psVectorElementFree(psVec);
     105    psFree(psVec);
    106106    for(int i = 0; i < 10; i++) {
    107107        psFree(mySt[i]);
  • trunk/psLib/test/collections/tst_psVector_03.c

    r867 r1073  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-06-04 19:51:49 $
     14 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-06-23 23:00:15 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828}
    2929testStruct;
    30 
    31 static void freeData(void *data)
    32 {
    33     psFree(data);
    34 }
    35 
    3630
    3731int main(int argc,
     
    5953        psVec->data.PTR[i] = ts;
    6054        psVec->n++;
    61         psMemIncrRefCounter(ts);
    6255    }
    6356
     
    8275        psVec->data.PTR[i] = ts;
    8376        psVec->n++;
    84         psMemIncrRefCounter(ts);
    8577    }
    8678    for(int i = 0; i < 10; i++) {
     
    9284    printFooter(stdout, "psVector", "Reallocate void pointer vector bigger", true);
    9385
    94 
    9586    // Test D - Reallocate void pointer vector smaller
    9687    printPositiveTestHeader(stdout,"psVector","Reallocate void pointer vector smaller");
    97     psVec = psVectorRealloc(3, psVec);
     88    psVec = psVectorRealloc(3, psVec); // this also frees the elements trimmed
    9889    for(int i = 0; i < 3; i++) {
    9990        testStruct *ts = (testStruct*)psVec->data.PTR[i];
     
    109100
    110101    // Free void pointer array struct and its 3 internal elements
    111     psVectorElementFree(psVec, freeData);
    112     psVectorFree(psVec);
     102    psFree(psVec);
    113103
    114     // Free 7 elements manually that were lost after array was reallocated smaller
    115     for(int i = 3; i < 10; i++) {
    116         psFree(mySt[i]);
     104    if (psMemCheckLeaks(0, NULL, stdout) != 0) {
     105        psAbort(__func__,"memory leaks");
    117106    }
    118     psMemCheckLeaks(0, NULL, stdout);
    119107    int nBad = psMemCheckCorruption(0);
    120108    if(nBad) {
  • trunk/psLib/test/collections/verified/tst_psBitSet_01.stderr

    r1018 r1073  
    1  <DATE> <TIME> <HOST> |E|   psBitSetTest| : Line 140 - Bit position too small: -4
    2  <DATE> <TIME> <HOST> |E|   psBitSetTest| : Line 143 - Bit position too large: 200
    3  <DATE> <TIME> <HOST> |E|   psBitSetTest| : Line 137 - Null psBitSet for inBitSet argument
    4  <DATE> <TIME> <HOST> |E|    psBitSetSet| : Line 118 - Bit position too small: -4
    5  <DATE> <TIME> <HOST> |E|    psBitSetSet| : Line 121 - Bit position too large: 200
    6  <DATE> <TIME> <HOST> |E|    psBitSetSet| : Line 115 - Null psBitSet for inBitSet argument
     1 <DATE> <TIME> <HOST> |E|   psBitSetTest| : Line 142 - Bit position too small: -4
     2 <DATE> <TIME> <HOST> |E|   psBitSetTest| : Line 145 - Bit position too large: 200
     3 <DATE> <TIME> <HOST> |E|   psBitSetTest| : Line 139 - Null psBitSet for inBitSet argument
     4 <DATE> <TIME> <HOST> |E|    psBitSetSet| : Line 120 - Bit position too small: -4
     5 <DATE> <TIME> <HOST> |E|    psBitSetSet| : Line 123 - Bit position too large: 200
     6 <DATE> <TIME> <HOST> |E|    psBitSetSet| : Line 117 - Null psBitSet for inBitSet argument
  • trunk/psLib/test/collections/verified/tst_psBitSet_05.stderr

    r1018 r1073  
    1  <DATE> <TIME> <HOST> |E|     psBitSetOp| : Line 187 - psBitSet sizes not the same
     1 <DATE> <TIME> <HOST> |E|     psBitSetOp| : Line 189 - psBitSet sizes not the same
  • trunk/psLib/test/collections/verified/tst_psBitSet_06.stderr

    r1018 r1073  
    1  <DATE> <TIME> <HOST> |E|     psBitSetOp| : Line 214 - Invalid psBitMask binary operation: ZZXOR
    2  <DATE> <TIME> <HOST> |E|  psBitSetAlloc| : Line 84 - Allocation size must be > 0: size = -4
    3  <DATE> <TIME> <HOST> |E|   psBitSetFree| : Line 103 - Null psBitSet for inBitSet argument
     1 <DATE> <TIME> <HOST> |E|     psBitSetOp| : Line 216 - Invalid psBitMask binary operation: ZZXOR
     2 <DATE> <TIME> <HOST> |E|  psBitSetAlloc| : Line 86 - Allocation size must be > 0: size = -4
  • trunk/psLib/test/collections/verified/tst_psBitSet_06.stdout

    r1041 r1073  
    3535/***************************** TESTPOINT ******************************************\
    3636*             TestFile: tst_psBitSet_06.c                                          *
    37 *            TestPoint: psBitSet{Attempt to free null BitSet}                      *
    38 *             TestType: Negative                                                   *
    39 *    ExpectedErrorText: Null psBitSet for inBitSet argument                        *
    40 *  ExpectedStatusValue: 0                                                          *
    41 \**********************************************************************************/
    42 
    43 
    44 ---> TESTPOINT PASSED (psBitSet{Attempt to free null BitSet} | tst_psBitSet_06.c)
    45 
    46 /***************************** TESTPOINT ******************************************\
    47 *             TestFile: tst_psBitSet_06.c                                          *
    4837*            TestPoint: psBitSet{Free psBitSets}                                   *
    4938*             TestType: Positive                                                   *
  • trunk/psLib/test/collections/verified/tst_psList.stderr

    r1034 r1073  
    3030
    3131 <DATE> <TIME> <HOST> |I|    testListGet|Following should be an error
    32  <DATE> <TIME> <HOST> |E|listSetIterator|Unexpected null pointer for psList parameter (psList.c:264).
     32 <DATE> <TIME> <HOST> |E|listSetIterator|Unexpected null pointer for psList parameter (psList.c:262).
    3333
    3434---> TESTPOINT PASSED (psList{489-testListGet} | tst_psList.c)
     
    7070 <DATE> <TIME> <HOST> |I|testListIterato| psListSetIterator/psListGetNext/psListGetPrev shall move the list cursor to the specified location
    7171 <DATE> <TIME> <HOST> |I|testListIterato|Following should error with 'Unexpected null pointer'
    72  <DATE> <TIME> <HOST> |E|listSetIterator|Unexpected null pointer for psList parameter (psList.c:264).
     72 <DATE> <TIME> <HOST> |E|listSetIterator|Unexpected null pointer for psList parameter (psList.c:262).
    7373 <DATE> <TIME> <HOST> |I|testListIterato|Following should error with 'Can't move to an unknown position.'
    7474 <DATE> <TIME> <HOST> |E|listSetIterator|Can't move to an unknown position.  Not moving the iterator position.
  • trunk/psLib/test/collections/verified/tst_psSort_03.stderr

    r1018 r1073  
    1  <DATE> <TIME> <HOST> |E|         psSort| : Line 136 - Input and output vector sizes are not equal: in=5 out=6
     1 <DATE> <TIME> <HOST> |E|         psSort| : Line 137 - Input and output vector sizes are not equal: in=5 out=6
  • trunk/psLib/test/collections/verified/tst_psSort_04.stderr

    r1018 r1073  
    1  <DATE> <TIME> <HOST> |E|         psSort| : Line 118 - Null input vector
     1 <DATE> <TIME> <HOST> |E|         psSort| : Line 119 - Null input vector
  • trunk/psLib/test/dataManip/tst_psFunc00.c

    r887 r1073  
    5353           psEvalPolynomial1D(MISC_X_VALUE, my1DPoly));
    5454
    55     psPolynomial1DFree(my1DPoly);
     55    psFree(my1DPoly);
    5656    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
    5757    if (0 != memLeaks) {
     
    8383           psEvalPolynomial2D(MISC_X_VALUE, MISC_X_VALUE, my2DPoly));
    8484
    85     psPolynomial2DFree(my2DPoly);
     85    psFree(my2DPoly);
    8686    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
    8787    if (0 != memLeaks) {
     
    114114           psEvalPolynomial3D(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my3DPoly));
    115115
    116     psPolynomial3DFree(my3DPoly);
     116    psFree(my3DPoly);
    117117    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
    118118    if (0 != memLeaks) {
     
    148148           psEvalPolynomial4D(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my4DPoly));
    149149
    150     psPolynomial4DFree(my4DPoly);
     150    psFree(my4DPoly);
    151151    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
    152152    if (0 != memLeaks) {
     
    178178           psDEvalPolynomial1D(MISC_X_VALUE, my1DPolyD));
    179179
    180     psDPolynomial1DFree(my1DPolyD);
     180    psFree(my1DPolyD);
    181181    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
    182182    if (0 != memLeaks) {
     
    187187                "Allocate/Deallocate the psDPolynomial1D structure.",
    188188                testStatus);
    189 
    190 
    191 
    192 
    193189
    194190    printPositiveTestHeader(stdout,
     
    208204           psDEvalPolynomial2D(MISC_X_VALUE, MISC_X_VALUE, my2DPolyD));
    209205
    210     psDPolynomial2DFree(my2DPolyD);
     206    psFree(my2DPolyD);
    211207    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
    212208    if (0 != memLeaks) {
     
    239235           psDEvalPolynomial3D(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my3DPolyD));
    240236
    241     psDPolynomial3DFree(my3DPolyD);
     237    psFree(my3DPolyD);
    242238    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
    243239    if (0 != memLeaks) {
     
    273269           psDEvalPolynomial4D(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my4DPolyD));
    274270
    275     psDPolynomial4DFree(my4DPolyD);
     271    psFree(my4DPolyD);
    276272    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
    277273    if (0 != memLeaks) {
  • trunk/psLib/test/dataManip/tst_psFunc01.c

    r887 r1073  
    5656    }
    5757
    58     psVectorFree(myGaussData);
     58    psFree(myGaussData);
    5959
    6060    psMemCheckCorruption(1);
  • trunk/psLib/test/dataManip/tst_psHist00.c

    r893 r1073  
    7979
    8080        psMemCheckCorruption(1);
    81         psHistogramFree(myHist);
     81        psFree(myHist);
    8282        psMemCheckCorruption(1);
    8383
  • trunk/psLib/test/dataManip/tst_psHist01.c

    r893 r1073  
    8484        }
    8585        psMemCheckCorruption(1);
    86         psHistogramFree(myHist);
     86        psFree(myHist);
    8787        psMemCheckCorruption(1);
    88         psVectorFree(myBounds);
     88        psFree(myBounds);
    8989
    9090        printFooter(stdout,
  • trunk/psLib/test/dataManip/tst_psHist02.c

    r893 r1073  
    7575        }
    7676        psMemCheckCorruption(1);
    77         psHistogramFree(myHist);
     77        psFree(myHist);
    7878        psMemCheckCorruption(1);
    7979
     
    100100        }
    101101        psMemCheckCorruption(1);
    102         psHistogramFree(myHist);
     102        psFree(myHist);
    103103        psMemCheckCorruption(1);
    104104
     
    108108                    testStatus);
    109109    }
    110     psVectorFree(myMask);
     110    psFree(myMask);
    111111
    112112    printPositiveTestHeader(stdout,
     
    122122        testStatus = false;
    123123    }
    124     psVectorFree(myData);
     124    psFree(myData);
    125125
    126126
     
    135135        testStatus = false;
    136136    }
    137     psHistogramFree(myHist);
     137    psFree(myHist);
    138138
    139139
     
    152152        testStatus = false;
    153153    }
    154     psHistogramFree(myHist);
    155     psVectorFree(myData);
     154    psFree(myHist);
     155    psFree(myData);
    156156    */
    157157    printFooter(stdout,
  • trunk/psLib/test/dataManip/tst_psMatrix01.c

    r899 r1073  
    1111 *  @author  Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    14  *  @date  $Date: 2004-06-07 20:47:52 $
     13 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     14 *  @date  $Date: 2004-06-23 23:00:17 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575    // Test D - Free images and check for leaks
    7676    printPositiveTestHeader(stdout, "psMatrix", "Free images and check for leaks");
    77     psImageFree(inImage);
    78     psImageFree(outImage);
    79     psImageFree(outImageNull);
     77    psFree(inImage);
     78    psFree(outImage);
     79    psFree(outImageNull);
    8080    psMemCheckLeaks(0, NULL, stdout);
    8181    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/dataManip/tst_psMatrix03.c

    r897 r1073  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2004-06-07 20:25:03 $
     16 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2004-06-23 23:00:17 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    104104    // Test D - Free input and output images and vectors
    105105    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images and vectors");
    106     psImageFree(inImage);
    107     psImageFree(luImage);
    108     psVectorFree(perm);
    109     psVectorFree(outVector);
    110     psVectorFree(inVector);
     106    psFree(inImage);
     107    psFree(luImage);
     108    psFree(perm);
     109    psFree(outVector);
     110    psFree(inVector);
    111111    psMemCheckLeaks(0, NULL, stdout);
    112112    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/dataManip/tst_psMatrix04.c

    r897 r1073  
    1313 *  @author  Ross Harman, MHPCC
    1414 *
    15  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    16  *  @date  $Date: 2004-06-07 20:25:03 $
     15 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     16 *  @date  $Date: 2004-06-23 23:00:17 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8282    // Test D - Free input and output images
    8383    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images");
    84     psImageFree(outImage);
    85     psImageFree(inImage);
     84    psFree(outImage);
     85    psFree(inImage);
    8686    psFree(det2);
    8787    psMemCheckLeaks(0, NULL, stdout);
  • trunk/psLib/test/dataManip/tst_psMatrix05.c

    r798 r1073  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-05-28 02:52:23 $
     12 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-23 23:00:17 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6565    // Test C - Free input and output images
    6666    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images");
    67     psImageFree(outImage);
    68     psImageFree(inImage1);
    69     psImageFree(inImage2);
     67    psFree(outImage);
     68    psFree(inImage1);
     69    psFree(inImage2);
    7070    psMemCheckLeaks(0, NULL, stdout);
    7171    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/dataManip/tst_psMatrix06.c

    r798 r1073  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-05-28 02:52:23 $
     12 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-23 23:00:17 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7474    // Test C - Free input and output images
    7575    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images");
    76     psImageFree(outImage);
    77     psImageFree(inImage);
     76    psFree(outImage);
     77    psFree(inImage);
    7878    psMemCheckLeaks(0, NULL, stdout);
    7979    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/dataManip/tst_psMatrix07.c

    r908 r1073  
    1616 *  @author  Ross Harman, MHPCC
    1717 *
    18  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    19  *  @date  $Date: 2004-06-08 01:56:35 $
     18 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     19 *  @date  $Date: 2004-06-23 23:00:17 $
    2020 *
    2121 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    157157    // Test I - Free input and output images
    158158    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images and vectors");
    159     psImageFree(m1);
    160     psVectorFree(v1);
    161     psImageFree(m2);
    162     psVectorFree(v2);
    163     psImageFree(m3);
    164     psImageFree(m4);
    165     psImageFree(badImage);
     159    psFree(m1);
     160    psFree(v1);
     161    psFree(m2);
     162    psFree(v2);
     163    psFree(m3);
     164    psFree(m4);
     165    psFree(badImage);
    166166    psMemCheckLeaks(0, NULL, stdout);
    167167    int nBad = psMemCheckCorruption(0);
  • trunk/psLib/test/dataManip/tst_psStats00.c

    r893 r1073  
    186186                            "psStats(): deallocating memory");
    187187
    188     psStatsFree(myStats);
    189     psVectorFree(myVector);
    190     psVectorFree(maskVector);
     188    psFree(myStats);
     189    psFree(myVector);
     190    psFree(maskVector);
    191191
    192192    psMemCheckCorruption(1);
  • trunk/psLib/test/dataManip/tst_psStats01.c

    r887 r1073  
    107107                            "psStats(): deallocating memory");
    108108
    109     psStatsFree(myStats);
    110     psVectorFree(myVector);
    111     psVectorFree(maskVector);
     109    psFree(myStats);
     110    psFree(myVector);
     111    psFree(maskVector);
    112112
    113113    psMemCheckCorruption(1);
  • trunk/psLib/test/dataManip/tst_psStats02.c

    r887 r1073  
    107107                            "psStats(): deallocating memory");
    108108
    109     psStatsFree(myStats);
    110     psVectorFree(myVector);
    111     psVectorFree(maskVector);
     109    psFree(myStats);
     110    psFree(myVector);
     111    psFree(maskVector);
    112112
    113113    psMemCheckCorruption(1);
  • trunk/psLib/test/dataManip/tst_psStats03.c

    r887 r1073  
    102102                            "psStats(): deallocating memory");
    103103
    104     psStatsFree(myStats);
    105     psVectorFree(myVector);
    106     psVectorFree(maskVector);
     104    psFree(myStats);
     105    psFree(myVector);
     106    psFree(maskVector);
    107107
    108108    psMemCheckCorruption(1);
  • trunk/psLib/test/dataManip/tst_psStats05.c

    r893 r1073  
    5959                            "psStats functions",
    6060                            "Deallocate the psStats structure.");
    61     psStatsFree(myStats);
     61    psFree(myStats);
    6262
    6363    psMemCheckCorruption(1);
     
    7373                testStatus);
    7474
    75 
    76 
    77     printPositiveTestHeader(stdout,
    78                             "psStats functions",
    79                             "Deallocate NULL psStats structure.");
    80     psStatsFree(NULL);
    81     printFooter(stdout,
    82                 "psStats functions",
    83                 "Deallocate NULL psStats structure.",
    84                 testStatus);
    85 
    86 
    8775    return (!testStatus);
    8876}
  • trunk/psLib/test/dataManip/tst_psStats06.c

    r887 r1073  
    110110                            "psStats(): deallocating memory");
    111111
    112     psStatsFree(myStats);
    113     psVectorFree(myVector);
    114     psVectorFree(maskVector);
     112    psFree(myStats);
     113    psFree(myVector);
     114    psFree(maskVector);
    115115
    116116    psMemCheckCorruption(1);
  • trunk/psLib/test/dataManip/tst_psStats07.c

    r1026 r1073  
    395395                            "psStats(): deallocating memory");
    396396
    397     psStatsFree(myStats);
    398     psVectorFree(myVector);
    399     psVectorFree(maskVector);
     397    psFree(myStats);
     398    psFree(myVector);
     399    psFree(maskVector);
    400400
    401401    psMemCheckCorruption(1);
  • trunk/psLib/test/dataManip/tst_psStats08.c

    r887 r1073  
    154154                            "psStats(): deallocating memory");
    155155
    156     psStatsFree(myStats);
    157     psVectorFree(myVector);
    158     psVectorFree(maskVector);
     156    psFree(myStats);
     157    psFree(myVector);
     158    psFree(maskVector);
    159159
    160160    psMemCheckCorruption(1);
  • trunk/psLib/test/dataManip/tst_psStats09.c

    r887 r1073  
    128128                            "psStats(): deallocating memory");
    129129
    130     psStatsFree(myStats);
    131     psVectorFree(myGaussData);
    132     psVectorFree(maskVector);
     130    psFree(myStats);
     131    psFree(myGaussData);
     132    psFree(maskVector);
    133133
    134134    psMemCheckCorruption(1);
  • trunk/psLib/test/dataManip/tst_psVectorFFT.c

    r1009 r1073  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-12 01:34:10 $
     8 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:17 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    112112    }
    113113
    114     psVectorFree(vec);
    115     psVectorFree(vec2);
    116     psVectorFree(vec3);
     114    psFree(vec);
     115    psFree(vec2);
     116    psFree(vec3);
    117117
    118118    return 0;
     
    177177    }
    178178
    179     psVectorFree(vec);
    180     psVectorFree(vec2);
    181     psVectorFree(vec3);
     179    psFree(vec);
     180    psFree(vec2);
     181    psFree(vec3);
    182182
    183183    return 0;
     
    262262    }
    263263
    264     psVectorFree(vec);
    265     psVectorFree(vec2);
    266     psVectorFree(vec3);
     264    psFree(vec);
     265    psFree(vec2);
     266    psFree(vec3);
    267267
    268268    return 0;
     
    307307    }
    308308
    309     psVectorFree(vec);
    310     psVectorFree(vec2);
     309    psFree(vec);
     310    psFree(vec2);
    311311
    312312    return 0;
     
    374374    };
    375375
    376     psVectorFree(vec);
    377     psVectorFree(vec2);
    378 
    379     return 0;
    380 }
     376    psFree(vec);
     377    psFree(vec2);
     378
     379    return 0;
     380}
  • trunk/psLib/test/dataManip/verified/tst_psStats05.stdout

    r1034 r1073  
    1717---> TESTPOINT PASSED (psStats functions{Deallocate the psStats structure.} | tst_psStats05.c)
    1818
    19 /***************************** TESTPOINT ******************************************\
    20 *             TestFile: tst_psStats05.c                                            *
    21 *            TestPoint: psStats functions{Deallocate NULL psStats structure.}      *
    22 *             TestType: Positive                                                   *
    23 \**********************************************************************************/
    24 
    25 
    26 ---> TESTPOINT PASSED (psStats functions{Deallocate NULL psStats structure.} | tst_psStats05.c)
    27 
  • trunk/psLib/test/image/tst_psImage.c

    r1033 r1073  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-14 23:03:43 $
     8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:15 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575                psError(__func__,"psImageAlloc returned NULL for type %x, size %dx%d.",
    7676                        type[t], numCols[i], numRows[i]);
    77                 psImageFree(image);
     77                psFree(image);
    7878                return 1;
    7979            }
     
    8282                psError(__func__,"psImageAlloc allocated wrong dimen/type (%d/%d), should be "
    8383                        "PS_IMAGE_DIMEN/%d", image->type.dimen, image->type.type, type[t]);
    84                 psImageFree(image);
     84                psFree(image);
    8585                return 2;
    8686            }
     
    8989                psError(__func__,"psImageAlloc allocated wrong size %dx%d, should be %dx%d (type = %d)",
    9090                        image->numCols, image->numRows, numCols[i], numRows[i],type[t]);
    91                 psImageFree(image);
     91                psFree(image);
    9292                return 3;
    9393            }
     
    9696                psError(__func__,"psImageAlloc returned row0/col0 of %d/%d.  Should be 0/0.",
    9797                        image->row0, image->row0);
    98                 psImageFree(image);
     98                psFree(image);
    9999                return 4;
    100100            }
     
    102102            if (image->parent != NULL) {
    103103                psError(__func__,"psImageAlloc returned non-NULL parent");
    104                 psImageFree(image);
     104                psFree(image);
    105105                return 5;
    106106            }
     
    108108            if (image->nChildren != 0) {
    109109                psError(__func__,"psImageAlloc returned non-zero number of children");
    110                 psImageFree(image);
     110                psFree(image);
    111111                return 6;
    112112            }
     
    114114            if (image->children != NULL) {
    115115                psError(__func__,"psImageAlloc returned non-NULL children vector");
    116                 psImageFree(image);
     116                psFree(image);
    117117                return 7;
    118118            }
     
    132132                            if (image->data.U16[r][c] != 2*c+r) {
    133133                                psError(__func__,"Could not set all pixels in uint16 image at (%d,%d)",c,r);
    134                                 psImageFree(image);
     134                                psFree(image);
    135135                                return 8;
    136136                            }
     
    152152                            if (fabsf(image->data.F32[r][c] - (2.0f*c+r)) > FLT_EPSILON) {
    153153                                psError(__func__,"Could not set all pixels in float image at (%d,%d)",c,r);
    154                                 psImageFree(image);
     154                                psFree(image);
    155155                                return 8;
    156156                            }
     
    172172                            if (fabs(image->data.F64[r][c] - (2.0f*c+r)) > DBL_EPSILON) {
    173173                                psError(__func__,"Could not set all pixels in double image at (%d,%d)",c,r);
    174                                 psImageFree(image);
     174                                psFree(image);
    175175                                return 8;
    176176                            }
     
    193193                                    fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON ) {
    194194                                psError(__func__,"Could not set all pixels in complex image at (%d,%d)",c,r);
    195                                 psImageFree(image);
     195                                psFree(image);
    196196                                return 8;
    197197                            }
     
    215215                                psError(__func__,"Could not set all pixels in image (type=%d) at (%d,%d)",
    216216                                        type[t],c,r);
    217                                 psImageFree(image);
     217                                psFree(image);
    218218                                return 8;
    219219                            }
     
    225225            // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with no
    226226            // children is freed.
    227             psImageFree(image);
     227            psFree(image);
    228228        }
    229229    }
    230230
    231231    // #548: Verify program execution doesn't stop, if the input psImage structure pointer is null.
    232     psImageFree(NULL);
     232    psFree(NULL);
    233233
    234234    // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with multiple
     
    238238    psImageSubset(NULL,image,50,50,20,20);
    239239
    240     psImageFree(image);
     240    psFree(image);
    241241
    242242    return 0;
     
    501501    }
    502502
    503     psImageFree(original);
     503    psFree(original);
    504504
    505505    return 0;
     
    599599    }
    600600
    601     psImageFree(img);
    602     psImageFree(img2);
     601    psFree(img);
     602    psFree(img2);
    603603
    604604    return 0;
     
    678678        return 2; \
    679679    } \
    680     psImageFree(img);
     680    psFree(img);
    681681
    682682    #define testImageClipByComplexType(datatype) \
     
    718718        return 2; \
    719719    } \
    720     psImageFree(img);
     720    psFree(img);
    721721
    722722    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F64 imagery");
     
    824824        return 2; \
    825825    } \
    826     psImageFree(img);
     826    psFree(img);
    827827
    828828    testImageClipNaNByType(F32);
     
    906906        } \
    907907    } \
    908     psImageFree(img); \
    909     psImageFree(img2);
     908    psFree(img); \
     909    psFree(img2);
    910910
    911911    #define testOverlayType(DATATYPE) \
     
    10161016    }
    10171017
    1018     psImageFree(img);
    1019     psImageFree(img2);
     1018    psFree(img);
     1019    psFree(img2);
    10201020
    10211021    return 0;
  • trunk/psLib/test/image/tst_psImageFFT.c

    r1014 r1073  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-12 19:46:04 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:17 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    116116    }
    117117
    118     psImageFree(img);
    119     psImageFree(img2);
    120     psImageFree(img3);
     118    psFree(img);
     119    psFree(img2);
     120    psFree(img3);
    121121
    122122    return 0;
     
    181181    }
    182182
    183     psImageFree(img);
    184     psImageFree(img2);
    185     psImageFree(img3);
     183    psFree(img);
     184    psFree(img2);
     185    psFree(img3);
    186186
    187187    return 0;
     
    265265    }
    266266
    267     psImageFree(img);
    268     psImageFree(img2);
    269     psImageFree(img3);
     267    psFree(img);
     268    psFree(img2);
     269    psFree(img3);
    270270
    271271    return 0;
     
    311311    }
    312312
    313     psImageFree(img);
    314     psImageFree(img2);
     313    psFree(img);
     314    psFree(img2);
    315315
    316316    return 0;
     
    359359    }
    360360
    361     psImageFree(img);
    362     psImageFree(img2);
    363 
    364     return 0;
    365 }
     361    psFree(img);
     362    psFree(img2);
     363
     364    return 0;
     365}
  • trunk/psLib/test/image/tst_psImageIO.c

    r1001 r1073  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-11 19:18:41 $
     8 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:17 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    107107            return 4; \
    108108        } \
    109         psImageFree(img); \
     109        psFree(img); \
    110110        img_ref = img = psImageAlloc(2,2,PS_TYPE_F32); \
    111         psImageFree(img3); \
     111        psFree(img3); \
    112112        img3 = NULL; \
    113113        img = psImageReadSection(img,readM0,readN0,readM,readN,0,NULL,0,filename); \
     
    139139            } \
    140140        } \
    141         psImageFree(img); \
     141        psFree(img); \
    142142        img = NULL; \
    143         psImageFree(img3); \
     143        psFree(img3); \
    144144        img3 = NULL; \
    145145        img3 = psImageReadSection(img3,readM0,readN0,readM,readN,0,NULL,1,filename); \
     
    167167            } \
    168168        } \
    169         psImageFree(img); \
    170         psImageFree(img2); \
    171         psImageFree(img3); \
    172         psImageFree(img4); \
     169        psFree(img); \
     170        psFree(img2); \
     171        psFree(img3); \
     172        psFree(img4); \
    173173    }
    174174
     
    302302        return 15;
    303303    }
    304     psImageFree(img);
    305     psImageFree(img2);
     304    psFree(img);
     305    psFree(img2);
    306306
    307307    // Did it really overwrite the pixel values?  Let's read it in and see.
     
    322322    }
    323323
    324     psImageFree(img);
     324    psFree(img);
    325325
    326326    return 0;
  • trunk/psLib/test/image/tst_psImageStats00.c

    r1041 r1073  
    9696                   myHist->nums->data.S32[i]);
    9797        }
    98         psHistogramFree(myHist);
     98        psFree(myHist);
    9999
    100100        psMemCheckCorruption(1);
     
    133133                                "psImageStats functions",
    134134                                "Deallocate the psHistogram/psImage structure.");
    135         psHistogramFree(myHist);
    136         psImageFree(tmpImage);
    137         psImageFree(tmpMask);
     135        psFree(myHist);
     136        psFree(tmpImage);
     137        psFree(tmpMask);
    138138
    139139        psMemCheckCorruption(1);
     
    167167
    168168    psMemCheckCorruption(1);
    169     psHistogramFree(myHist);
    170     psImageFree(tmpImage);
     169    psFree(myHist);
     170    psFree(tmpImage);
    171171    psMemCheckCorruption(1);
    172172    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
  • trunk/psLib/test/image/tst_psImageStats01.c

    r904 r1073  
    123123                                "psImageStats functions",
    124124                                "Deallocate the psStats/psImage structure.");
    125         psStatsFree(myStats);
    126         psImageFree(tmpImage);
    127         psImageFree(tmpMask);
     125        psFree(myStats);
     126        psFree(tmpImage);
     127        psFree(tmpMask);
    128128
    129129        psMemCheckCorruption(1);
     
    165165    //
    166166
    167     psStatsFree(myStats);
    168     psImageFree(tmpImage);
    169     psImageFree(tmpMask);
     167    psFree(myStats);
     168    psFree(tmpImage);
     169    psFree(tmpMask);
    170170
    171171    psMemCheckCorruption(1);
  • trunk/psLib/test/image/tst_psImageStats02.c

    r1072 r1073  
    102102                            "psImageStats functions",
    103103                            "Deallocate the psStats/psImage structure.");
    104     psStatsFree(myStats);
    105     psImageFree(tmpImage);
    106     psImageFree(outImage);
    107     psPolynomial2DFree(my2DPoly);
     104    psFree(myStats);
     105    psFree(tmpImage);
     106    psFree(outImage);
     107    psFree(my2DPoly);
    108108
    109109    psMemCheckCorruption(1);
  • trunk/psLib/test/image/verified/tst_psImageStats02.stdout

    r1034 r1073  
    55\**********************************************************************************/
    66
     7SUM(Cheby(0) * Cheby(0)) is 3.000000
     8SUM(Cheby(0) * Cheby(1)) is -0.000000
     9SUM(Cheby(0) * Cheby(2)) is 0.000000
     10SUM(Cheby(1) * Cheby(0)) is -0.000000
     11SUM(Cheby(1) * Cheby(1)) is 1.500000
     12SUM(Cheby(1) * Cheby(2)) is 0.000000
     13SUM(Cheby(2) * Cheby(0)) is 0.000000
     14SUM(Cheby(2) * Cheby(1)) is 0.000000
     15SUM(Cheby(2) * Cheby(2)) is 1.500000
     16Cheby Polynomial (0, 0) coefficient is 6.000000
     17Cheby Polynomial (0, 1) coefficient is 1.154701
     18Cheby Polynomial (0, 2) coefficient is 0.000000
     19Cheby Polynomial (1, 0) coefficient is 5.773502
     20Cheby Polynomial (1, 1) coefficient is -0.000000
     21Cheby Polynomial (1, 2) coefficient is -0.000000
     22Cheby Polynomial (2, 0) coefficient is 0.000000
     23Cheby Polynomial (2, 1) coefficient is 0.000000
     24Cheby Polynomial (2, 2) coefficient is 0.000000
    725
    826---> TESTPOINT PASSED (psImageStats functions{Calculate Chebyshev Polynomials, no mask} | tst_psImageStats02.c)
  • trunk/psLib/test/sysUtils/builddir/atst_psAbort_01.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/atst_psAbort_02.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/atst_psAbort_03.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psError.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psHash00.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psHash01.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psHash02.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psHash03.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psHash04.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psLogMsg00.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psLogMsg01.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psLogMsg02.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psLogMsg03.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psMemory.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h
  • trunk/psLib/test/sysUtils/builddir/tst_psStringCopy.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psTrace00.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psTrace01.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psTrace02.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psTrace03.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/builddir/tst_psTrace04.d

    r1004 r1073  
    33  ../../include/psTrace.h ../../include/psAbort.h ../../include/psError.h \
    44  ../../include/psString.h ../../include/psType.h ../../include/psList.h \
    5   ../../include/psVector.h ../../include/psHash.h ../../include/psImage.h \
     5  ../../include/psVector.h ../../include/psHash.h \
     6  ../../include/psScalar.h ../../include/psImage.h \
    67  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    7   ../../include/psMatrix.h ../../include/psFFT.h \
    8   ../../include/psImageIO.h ../../include/psTest.h
     8  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
     9  ../../include/psFFT.h ../../include/psImageIO.h ../../include/psTest.h
  • trunk/psLib/test/sysUtils/tst_psHash00.c

    r881 r1073  
    5353                testStatus);
    5454
    55     psHashFree(myHashTable, NULL);
     55    psFree(myHashTable);
    5656
    57     memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
     57    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
    5858    if (0 != memLeaks) {
    5959        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
  • trunk/psLib/test/sysUtils/tst_psHash01.c

    r881 r1073  
    1414}
    1515ID;
     16
     17static void IdFree(ID *id);
     18
    1619static ID *IdAlloc(const char *name)
    1720{
    1821    ID *id = psAlloc(sizeof(ID));
     22    p_psMemSetDeallocator(id,(psFreeFcn)IdFree);
    1923    id->name = psStringCopy(name);
    2024
     
    2630    imGlobal++;
    2731    psFree(id->name);
    28     psFree(id);
    2932}
    3033
     
    3437    int testStatus      = true;
    3538    int currentId = psMemGetId();
     39    ID* id = NULL;
    3640    int memLeaks        = 0;
    3741
     
    4145
    4246    myHashTable = psHashAlloc(NUM_HASH_TABLE_BUCKETS);
    43     psHashInsert(myHashTable, "ENTRY00", IdAlloc("IDA"),
    44                  (void (*)(void *))IdFree);
    45     psHashInsert(myHashTable, "ENTRY01", IdAlloc("IDB"),
    46                  (void (*)(void *))IdFree);
    47     psHashInsert(myHashTable, "ENTRY02", IdAlloc("IDC"),
    48                  (void (*)(void *))IdFree);
    49     psHashInsert(myHashTable, "ENTRY03", IdAlloc("IDD"),
    50                  (void (*)(void *))IdFree);
    51     psHashFree(myHashTable, (void (*)(void *))IdFree);
     47    id = IdAlloc("IDA");
     48    psHashInsert(myHashTable, "ENTRY00", id);
     49    psFree(id);
     50    id = IdAlloc("IDB");
     51    psHashInsert(myHashTable, "ENTRY01", id);
     52    psFree(id);
     53    id = IdAlloc("IDC");
     54    psHashInsert(myHashTable, "ENTRY02", id);
     55    psFree(id);
     56    id = IdAlloc("IDD");
     57    psHashInsert(myHashTable, "ENTRY03", id);
     58    psFree(id);
     59    psFree(myHashTable);
    5260
    5361    if (imGlobal != 4) {
  • trunk/psLib/test/sysUtils/tst_psHash02.c

    r1022 r1073  
    1919}
    2020ID;
     21static void IdFree(ID *id);
     22
    2123static ID *IdAlloc(const char *name)
    2224{
    2325    ID *id = psAlloc(sizeof(ID));
     26    p_psMemSetDeallocator(id,(psFreeFcn)IdFree);
    2427    id->name = psStringCopy(name);
    2528
     
    3134    imGlobal++;
    3235    psFree(id->name);
    33     psFree(id);
    3436}
    3537
     
    5254    i = 0;
    5355    while (myKeys[i] != NULL) {
    54         psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i]),
    55                      (void (*)(void *))IdFree);
     56        id = IdAlloc(myData[i]);
     57        psHashInsert(myHashTable, myKeys[i], id);
     58        psFree(id);
    5659        i++;
    5760    }
     
    7881
    7982    //    psHashFree(myHashTable, NULL);
    80     psHashFree(myHashTable, (void (*)(void *))IdFree);
     83    psFree(myHashTable);
    8184
    8285    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
  • trunk/psLib/test/sysUtils/tst_psHash03.c

    r1022 r1073  
    1919}
    2020ID;
     21static void IdFree(ID *id);
    2122
    2223// NOTE: This is my own little routine I used in debugging a memory
     
    4849
    4950    id = psAlloc(sizeof(ID));
     51    p_psMemSetDeallocator(id,(psFreeFcn)IdFree);
    5052
    5153    id->name = psStringCopy(name);
     
    5860    imGlobal++;
    5961    psFree(id->name);
    60     psFree(id);
    6162}
    6263
     
    8283    i = 0;
    8384    while (myKeys[i] != NULL) {
    84         psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i]),
    85                      (void (*)(void *))IdFree);
     85        psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i]));
    8686        i++;
    8787    }
     
    101101    i = 0;
    102102    while (myKeys[i] != NULL) {
    103         id = psHashRemove(myHashTable, myKeys[i], (void (*)(void *))IdFree);
     103        id = psHashRemove(myHashTable, myKeys[i]);
    104104        // The psHashRemove() procedure removes the entry from the hash
    105105        // table, but does not delete the data.  The following is necessary
    106106        // to delete the data as well (which is returned from the call).
    107         IdFree(id);
     107        psFree(id);
    108108        id = psHashLookup(myHashTable, myKeys[i]);
    109109        if (id != NULL) {
     
    119119                testStatus);
    120120
    121     psHashFree(myHashTable, (void (*)(void *))IdFree);
    122     memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
     121    psFree(myHashTable);
     122    memLeaks = psMemCheckLeaks(currentId,NULL,stdout);
    123123    if (0 != memLeaks) {
    124124        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
  • trunk/psLib/test/sysUtils/tst_psHash04.c

    r929 r1073  
    1414}
    1515ID;
     16static void IdFree(ID *id);
     17
    1618static ID *IdAlloc(const char *name)
    1719{
    1820    ID *id = psAlloc(sizeof(ID));
     21    p_psMemSetDeallocator(id,(psFreeFcn)IdFree);
     22
    1923    id->name = psStringCopy(name);
    2024
     
    2630    imGlobal++;
    2731    psFree(id->name);
    28     psFree(id);
    2932}
    3033
     
    4043    psList *myLinkList = NULL;
    4144    psListElem *tmp = NULL;
     45    ID* id = NULL;
    4246
    4347    printPositiveTestHeader(stdout,
     
    4852    i = 0;
    4953    while (myKeys[i] != NULL) {
    50         psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i]),
    51                      (void (*)(void *))IdFree);
     54        id = IdAlloc(myData[i]);
     55        psHashInsert(myHashTable, myKeys[i], id);
     56        psFree(id);
    5257        i++;
    5358    }
     
    5964    }
    6065
    61     psListFree(myLinkList, NULL);
     66    psFree(myLinkList);
    6267
    6368    printFooter(stdout,
     
    6671                testStatus);
    6772
    68     psHashFree(myHashTable, (void (*)(void *))IdFree);
     73    psFree(myHashTable);
    6974
    70     memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
     75    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
    7176    if (0 != memLeaks) {
    7277        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
  • trunk/psLib/test/sysUtils/verified/tst_psMemory.stderr

    r1034 r1073  
    8181 <DATE> <TIME> <HOST> |I|TPmemCorruption|psMemCheckCorruption should output an error message and memProblemCallback callback should be called.
    8282 <DATE> <TIME> <HOST> |E|psMemCheckCorru|psMemCheckCorruption: memory block 1 is corrupted (buffer underflow)
    83  <DATE> <TIME> <HOST> |I|memProblemCallb|memory callback called for id 1 (psMemCheckCorruption:228).
     83 <DATE> <TIME> <HOST> |I|memProblemCallb|memory callback called for id 1 (psMemCheckCorruption:226).
    8484
    8585---> TESTPOINT PASSED (psMemory{455-TPmemCorruption} | tst_psMemory.c)
Note: See TracChangeset for help on using the changeset viewer.