IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4308 for trunk/psLib/src


Ignore:
Timestamp:
Jun 17, 2005, 1:44:22 PM (21 years ago)
Author:
desonia
Message:

added enhancement to psFree so that it sets the reference being freed to
NULL (thanks Gus).

Location:
trunk/psLib/src
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astronomy/psAstrometry.c

    r4143 r4308  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-06-08 00:26:01 $
     10 *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-06-17 23:44:21 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5555        psFree(fpa->chips);
    5656        psFree(fpa->grommit);
    57         psFree((psExposure*)fpa->exposure);
     57        psFree(fpa->exposure);
    5858        psFree(fpa->metadata);
    5959        psFree(fpa->fromTangentPlane);
     
    102102{
    103103    if (obs != NULL) {
    104         psFree((psPtr)obs->name);
     104        psFree(obs->name);
    105105    }
    106106}
     
    109109{
    110110    if (exp != NULL) {
    111         psFree((psPtr)exp->time);
    112         psFree((psPtr)exp->observatory);
    113         psFree((psPtr)exp->cameraName);
    114         psFree((psPtr)exp->telescopeName);
     111        psFree(exp->time);
     112        psFree(exp->observatory);
     113        psFree(exp->cameraName);
     114        psFree(exp->telescopeName);
    115115    }
    116116}
  • trunk/psLib/src/collections/psMetadata.c

    r4094 r4308  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-06-03 02:07:51 $
     14*  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2005-06-17 23:44:21 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8989
    9090    psHashAdd(table, key, item); // put in the new entry
     91    psMemDecrRefCounter(item); // get rid of extra reference
    9192
    9293    // free local references of newly allocated items.
    9394    psFree(newList);
    94     psFree(item);
    9595
    9696    return item;
     
    107107    }
    108108
    109     psFree(metadataItem->name);
    110     psFree(metadataItem->comment);
     109    psMemDecrRefCounter(metadataItem->name);
     110    psMemDecrRefCounter(metadataItem->comment);
    111111
    112112    if(!PS_META_IS_PRIMITIVE(type)) {
  • trunk/psLib/src/dataIO/psFits.c

    r4193 r4308  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-09 21:17:45 $
     9 *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-06-17 23:44:21 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    203203    if (fits != NULL) {
    204204        (void)fits_close_file(fits->p_fd, &status);
    205         psFree((void*)fits->filename);
     205        psFree(fits->filename);
    206206    }
    207207}
  • trunk/psLib/src/dataIO/psFits.h

    r4214 r4308  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-11 02:19:05 $
     9 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-06-17 23:44:21 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3333 */
    3434typedef enum {
    35     PS_FITS_TYPE_NONE = -1,    ///< Unknown HDU type
    36     PS_FITS_TYPE_IMAGE = IMAGE_HDU,   ///< Image HDU type
    37     PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL,   ///< Binary table HDU type
    38     PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL,  ///< ASCII table HDU type
    39     PS_FITS_TYPE_ANY = ANY_HDU    ///< Any HDU type
     35    PS_FITS_TYPE_NONE = -1,            ///< Unknown HDU type
     36    PS_FITS_TYPE_IMAGE = IMAGE_HDU,    ///< Image HDU type
     37    PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL, ///< Binary table HDU type
     38    PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL,   ///< ASCII table HDU type
     39    PS_FITS_TYPE_ANY = ANY_HDU         ///< Any HDU type
    4040} psFitsType;
    4141
  • trunk/psLib/src/dataIO/psLookupTable.c

    r4167 r4308  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-06-09 00:56:37 $
     9*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-06-17 23:44:21 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    246246
    247247    psFree(table->values);
    248     psFree((char*)table->filename);
    249     psFree((char*)table->format);
     248    psFree(table->filename);
     249    psFree(table->format);
    250250}
    251251
  • trunk/psLib/src/fits/psFits.c

    r4193 r4308  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-09 21:17:45 $
     9 *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-06-17 23:44:21 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    203203    if (fits != NULL) {
    204204        (void)fits_close_file(fits->p_fd, &status);
    205         psFree((void*)fits->filename);
     205        psFree(fits->filename);
    206206    }
    207207}
  • trunk/psLib/src/fits/psFits.h

    r4214 r4308  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-11 02:19:05 $
     9 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-06-17 23:44:21 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3333 */
    3434typedef enum {
    35     PS_FITS_TYPE_NONE = -1,    ///< Unknown HDU type
    36     PS_FITS_TYPE_IMAGE = IMAGE_HDU,   ///< Image HDU type
    37     PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL,   ///< Binary table HDU type
    38     PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL,  ///< ASCII table HDU type
    39     PS_FITS_TYPE_ANY = ANY_HDU    ///< Any HDU type
     35    PS_FITS_TYPE_NONE = -1,            ///< Unknown HDU type
     36    PS_FITS_TYPE_IMAGE = IMAGE_HDU,    ///< Image HDU type
     37    PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL, ///< Binary table HDU type
     38    PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL,   ///< ASCII table HDU type
     39    PS_FITS_TYPE_ANY = ANY_HDU         ///< Any HDU type
    4040} psFitsType;
    4141
  • trunk/psLib/src/image/psImageGeomManip.c

    r4287 r4308  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-06-16 22:07:41 $
     12 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-06-17 23:44:21 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    865865    }
    866866
     867    psFree(inPosition);
     868
    867869    return output;
    868870}
  • trunk/psLib/src/imageops/psImageGeomManip.c

    r4287 r4308  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-06-16 22:07:41 $
     12 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-06-17 23:44:21 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    865865    }
    866866
     867    psFree(inPosition);
     868
    867869    return output;
    868870}
  • trunk/psLib/src/sys/psErrorCodes.c

    r3682 r4308  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-04-07 20:27:41 $
     9 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-06-17 23:44:21 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929 *     $2  The error description (rest of the line in psErrorCodes.dat)
    3030 *     $n  The order of the source line in psErrorCodes.dat (comments excluded)
    31  * 
     31 *
    3232 * DO NOT EDIT THE LINES BETWEEN //~Start and //~End!  ANY CHANGES WILL BE OVERWRITTEN.
    3333 */
     
    9090static void freeErrorDescription(psErrorDescription* err)
    9191{
    92     psFree((psPtr)err->description);
     92    psFree(err->description);
    9393}
    9494
  • trunk/psLib/src/sys/psMemory.h

    r4298 r4308  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-17 21:42:02 $
     14 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-17 23:44:21 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    239239/// Free memory.  psFree sends file and line number to p_psFree.
    240240#ifndef SWIG
    241 #define psFree(ptr) p_psFree(ptr, __FILE__, __LINE__)
     241#define psFree(ptr) { p_psFree((psPtr)ptr, __FILE__, __LINE__);  *(void**)&ptr = NULL; }
    242242#endif // ! SWIG
    243243
  • trunk/psLib/src/sys/psTrace.c

    r4162 r4308  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-08 23:40:45 $
     11 *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-17 23:44:21 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9797
    9898    p_psMemSetPersistent((psPtr)comp->name,false);
    99     psFree((psPtr)comp->name);
     99    psFree(comp->name);
    100100}
    101101
  • trunk/psLib/src/sysUtils/psErrorCodes.c

    r3682 r4308  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-04-07 20:27:41 $
     9 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-06-17 23:44:21 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929 *     $2  The error description (rest of the line in psErrorCodes.dat)
    3030 *     $n  The order of the source line in psErrorCodes.dat (comments excluded)
    31  * 
     31 *
    3232 * DO NOT EDIT THE LINES BETWEEN //~Start and //~End!  ANY CHANGES WILL BE OVERWRITTEN.
    3333 */
     
    9090static void freeErrorDescription(psErrorDescription* err)
    9191{
    92     psFree((psPtr)err->description);
     92    psFree(err->description);
    9393}
    9494
  • trunk/psLib/src/sysUtils/psMemory.h

    r4298 r4308  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-17 21:42:02 $
     14 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-17 23:44:21 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    239239/// Free memory.  psFree sends file and line number to p_psFree.
    240240#ifndef SWIG
    241 #define psFree(ptr) p_psFree(ptr, __FILE__, __LINE__)
     241#define psFree(ptr) { p_psFree((psPtr)ptr, __FILE__, __LINE__);  *(void**)&ptr = NULL; }
    242242#endif // ! SWIG
    243243
  • trunk/psLib/src/sysUtils/psTrace.c

    r4162 r4308  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-08 23:40:45 $
     11 *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-17 23:44:21 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9797
    9898    p_psMemSetPersistent((psPtr)comp->name,false);
    99     psFree((psPtr)comp->name);
     99    psFree(comp->name);
    100100}
    101101
  • trunk/psLib/src/types/psLookupTable.c

    r4167 r4308  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-06-09 00:56:37 $
     9*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-06-17 23:44:21 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    246246
    247247    psFree(table->values);
    248     psFree((char*)table->filename);
    249     psFree((char*)table->format);
     248    psFree(table->filename);
     249    psFree(table->format);
    250250}
    251251
  • trunk/psLib/src/types/psMetadata.c

    r4094 r4308  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-06-03 02:07:51 $
     14*  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2005-06-17 23:44:21 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8989
    9090    psHashAdd(table, key, item); // put in the new entry
     91    psMemDecrRefCounter(item); // get rid of extra reference
    9192
    9293    // free local references of newly allocated items.
    9394    psFree(newList);
    94     psFree(item);
    9595
    9696    return item;
     
    107107    }
    108108
    109     psFree(metadataItem->name);
    110     psFree(metadataItem->comment);
     109    psMemDecrRefCounter(metadataItem->name);
     110    psMemDecrRefCounter(metadataItem->comment);
    111111
    112112    if(!PS_META_IS_PRIMITIVE(type)) {
Note: See TracChangeset for help on using the changeset viewer.