IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 876


Ignore:
Timestamp:
Jun 4, 2004, 1:46:48 PM (22 years ago)
Author:
desonia
Message:

Added p_psCustomFree to handle the use of PS_FREE for a free fcn given to things like psDlistFree.

Location:
trunk/psLib/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psMemory.c

    r850 r876  
    88 *  @author Robert Lupton, Princeton University
    99 *
    10  *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-06-04 02:17:32 $
     10 *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-06-04 23:46:48 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    507507}
    508508
     509void p_psCustomFree(psFreeFcn fcn, void* ptr)
     510{
     511
     512    if (fcn == NULL) {
     513        return;
     514    } else {
     515        if (fcn == PS_FREE) {
     516            psFree(ptr);
     517        } else {
     518            fcn(ptr);
     519        }
     520    }
     521}
  • trunk/psLib/src/sys/psMemory.h

    r830 r876  
    1212 *  @author Robert Lupton, Princeton University
    1313 *
    14  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-06-02 20:03:22 $
     14 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-06-04 23:46:48 $
    1616 *
    1717 *  @ingroup SystemGroup System Utilities
     
    113113);
    114114
     115typedef void (*psFreeFcn)(void* ptr);
     116
    115117/** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
    116118 *
     
    277279);
    278280
     281#define PS_FREE     (void*)1
     282
     283void p_psCustomFree(psFreeFcn fcn,void* ptr);
     284
    279285//@} End of Memory Management Functions
    280286
  • trunk/psLib/src/sysUtils/psMemory.c

    r850 r876  
    88 *  @author Robert Lupton, Princeton University
    99 *
    10  *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-06-04 02:17:32 $
     10 *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-06-04 23:46:48 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    507507}
    508508
     509void p_psCustomFree(psFreeFcn fcn, void* ptr)
     510{
     511
     512    if (fcn == NULL) {
     513        return;
     514    } else {
     515        if (fcn == PS_FREE) {
     516            psFree(ptr);
     517        } else {
     518            fcn(ptr);
     519        }
     520    }
     521}
  • trunk/psLib/src/sysUtils/psMemory.h

    r830 r876  
    1212 *  @author Robert Lupton, Princeton University
    1313 *
    14  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-06-02 20:03:22 $
     14 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-06-04 23:46:48 $
    1616 *
    1717 *  @ingroup SystemGroup System Utilities
     
    113113);
    114114
     115typedef void (*psFreeFcn)(void* ptr);
     116
    115117/** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
    116118 *
     
    277279);
    278280
     281#define PS_FREE     (void*)1
     282
     283void p_psCustomFree(psFreeFcn fcn,void* ptr);
     284
    279285//@} End of Memory Management Functions
    280286
Note: See TracChangeset for help on using the changeset viewer.