IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4397


Ignore:
Timestamp:
Jun 24, 2005, 5:32:42 PM (21 years ago)
Author:
drobbin
Message:

changed psMemoryId to psMemId

Location:
trunk/psLib
Files:
6 edited

Legend:

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

    r4392 r4397  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-06-25 02:02:05 $
     10*  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2005-06-25 03:32:42 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5555 * Unique ID for allocated blocks
    5656 */
    57 static psMemoryId memid = 0;
     57static psMemId memid = 0;
    5858
    5959/**
     
    8888 * isn't resignalled)
    8989 */
    90 static psMemoryId memAllocateCallbackDefault(const psMemBlock* ptr)
    91 {
    92     static psMemoryId incr = 0; // "p_psMemAllocateID += incr"
     90static psMemId memAllocateCallbackDefault(const psMemBlock* ptr)
     91{
     92    static psMemId incr = 0; // "p_psMemAllocateID += incr"
    9393
    9494    return incr;
    9595}
    9696
    97 static psMemoryId memFreeCallbackDefault(const psMemBlock* ptr)
    98 {
    99     static psMemoryId incr = 0; // "p_psMemFreeID += incr"
     97static psMemId memFreeCallbackDefault(const psMemBlock* ptr)
     98{
     99    static psMemId incr = 0; // "p_psMemFreeID += incr"
    100100
    101101    return incr;
     
    194194 * Call the callbacks when these IDs are allocated/freed
    195195 */
    196 psMemoryId p_psMemAllocateID = 0;       // notify user this block is allocated
    197 psMemoryId p_psMemFreeID = 0;   // notify user this block is freed
    198 
    199 psMemoryId psMemAllocateCallbackSetID(psMemoryId id)
    200 {
    201     psMemoryId old = p_psMemAllocateID;
     196psMemId p_psMemAllocateID = 0;       // notify user this block is allocated
     197psMemId p_psMemFreeID = 0;   // notify user this block is freed
     198
     199psMemId psMemAllocateCallbackSetID(psMemId id)
     200{
     201    psMemId old = p_psMemAllocateID;
    202202
    203203    p_psMemAllocateID = id;
     
    206206}
    207207
    208 psMemoryId psMemFreeCallbackSetID(psMemoryId id)
    209 {
    210     psMemoryId old = p_psMemFreeID;
     208psMemId psMemFreeCallbackSetID(psMemId id)
     209{
     210    psMemId old = p_psMemFreeID;
    211211
    212212    p_psMemFreeID = id;
     
    244244 * Return memory ID counter for next block to be allocated
    245245 */
    246 psMemoryId psMemGetId(void)
    247 {
    248     psMemoryId id;
     246psMemId psMemGetId(void)
     247{
     248    psMemId id;
    249249
    250250    pthread_mutex_lock(&memIdMutex);
     
    338338    // increment the memory id safely.
    339339    pthread_mutex_lock(&memBlockListMutex);
    340     *(psMemoryId* ) & ptr->id = ++memid;
     340    *(psMemId* ) & ptr->id = ++memid;
    341341    pthread_mutex_unlock(&memBlockListMutex);
    342342
     
    448448 * Check for memory leaks.
    449449 */
    450 psS32 psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd, psBool persistence)
     450psS32 psMemCheckLeaks(psMemId id0, psMemBlock* ** arr, FILE * fd, psBool persistence)
    451451{
    452452    psS32 nleak = 0;
  • trunk/psLib/src/sys/psMemory.h

    r4392 r4397  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-25 02:02:05 $
     14 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-25 03:32:42 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4949
    5050/// typedef for memory identification numbers.  Guaranteed to be some variety of integer.
    51 typedef psU64 psMemoryId;
     51typedef psU64 psMemId;
    5252
    5353/// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
     
    6969    psFreeFunc freeFcn;                 ///< deallocator.  If NULL, use generic deallocation.
    7070    size_t userMemorySize;             ///< the size of the user-portion of the memory block
    71     const psMemoryId id;               ///< a unique ID for this allocation
     71    const psMemId id;               ///< a unique ID for this allocation
    7272    const char *file;                  ///< set from __FILE__ in e.g. p_psAlloc
    7373    const psS32 lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
     
    8484 *  @ingroup memCallback
    8585 */
    86 typedef psMemoryId(*psMemAllocateCallback) (
     86typedef psMemId(*psMemAllocateCallback) (
    8787    const psMemBlock* ptr              ///< the psMemBlock just allocated
    8888);
     
    9393 *  @ingroup memCallback
    9494 */
    95 typedef psMemoryId(*psMemFreeCallback) (
     95typedef psMemId(*psMemFreeCallback) (
    9696    const psMemBlock* ptr              ///< the psMemBlock being freed
    9797);
     
    259259 */
    260260psS32 psMemCheckLeaks(
    261     psMemoryId id0,                    ///< don't list blocks with id < id0
     261    psMemId id0,                    ///< don't list blocks with id < id0
    262262    psMemBlock* ** arr,                ///< pointer to array of pointers to leaked blocks, or NULL
    263263    FILE * fd,                         ///< print list of leaks to fd (or NULL)
     
    394394 *  @ingroup memCallback
    395395 *
    396  *  @return psMemoryId                 the next memory ID to be used
    397  */
    398 psMemoryId psMemGetId(void);
     396 *  @return psMemId                 the next memory ID to be used
     397 */
     398psMemId psMemGetId(void);
    399399
    400400/** set p_psMemAllocateID to specific id
     
    407407 *  @ingroup memCallback
    408408 *
    409  *  @return psMemoryId
     409 *  @return psMemId
    410410 *
    411411 *  @see psMemAllocateCallbackSet
    412412 */
    413 psMemoryId psMemAllocateCallbackSetID(
    414     psMemoryId id                      ///< ID to set
     413psMemId psMemAllocateCallbackSetID(
     414    psMemId id                      ///< ID to set
    415415);
    416416
     
    424424 *  @ingroup memCallback
    425425 *
    426  *  @return psMemoryId                 the old p_psMemFreeID
     426 *  @return psMemId                 the old p_psMemFreeID
    427427 *
    428428 *  @see psMemFreeCallbackSet
    429429 */
    430 psMemoryId psMemFreeCallbackSetID(
    431     psMemoryId id                      ///< ID to set
     430psMemId psMemFreeCallbackSetID(
     431    psMemId id                      ///< ID to set
    432432);
    433433
  • trunk/psLib/src/sysUtils/psMemory.c

    r4392 r4397  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-06-25 02:02:05 $
     10*  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2005-06-25 03:32:42 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5555 * Unique ID for allocated blocks
    5656 */
    57 static psMemoryId memid = 0;
     57static psMemId memid = 0;
    5858
    5959/**
     
    8888 * isn't resignalled)
    8989 */
    90 static psMemoryId memAllocateCallbackDefault(const psMemBlock* ptr)
    91 {
    92     static psMemoryId incr = 0; // "p_psMemAllocateID += incr"
     90static psMemId memAllocateCallbackDefault(const psMemBlock* ptr)
     91{
     92    static psMemId incr = 0; // "p_psMemAllocateID += incr"
    9393
    9494    return incr;
    9595}
    9696
    97 static psMemoryId memFreeCallbackDefault(const psMemBlock* ptr)
    98 {
    99     static psMemoryId incr = 0; // "p_psMemFreeID += incr"
     97static psMemId memFreeCallbackDefault(const psMemBlock* ptr)
     98{
     99    static psMemId incr = 0; // "p_psMemFreeID += incr"
    100100
    101101    return incr;
     
    194194 * Call the callbacks when these IDs are allocated/freed
    195195 */
    196 psMemoryId p_psMemAllocateID = 0;       // notify user this block is allocated
    197 psMemoryId p_psMemFreeID = 0;   // notify user this block is freed
    198 
    199 psMemoryId psMemAllocateCallbackSetID(psMemoryId id)
    200 {
    201     psMemoryId old = p_psMemAllocateID;
     196psMemId p_psMemAllocateID = 0;       // notify user this block is allocated
     197psMemId p_psMemFreeID = 0;   // notify user this block is freed
     198
     199psMemId psMemAllocateCallbackSetID(psMemId id)
     200{
     201    psMemId old = p_psMemAllocateID;
    202202
    203203    p_psMemAllocateID = id;
     
    206206}
    207207
    208 psMemoryId psMemFreeCallbackSetID(psMemoryId id)
    209 {
    210     psMemoryId old = p_psMemFreeID;
     208psMemId psMemFreeCallbackSetID(psMemId id)
     209{
     210    psMemId old = p_psMemFreeID;
    211211
    212212    p_psMemFreeID = id;
     
    244244 * Return memory ID counter for next block to be allocated
    245245 */
    246 psMemoryId psMemGetId(void)
    247 {
    248     psMemoryId id;
     246psMemId psMemGetId(void)
     247{
     248    psMemId id;
    249249
    250250    pthread_mutex_lock(&memIdMutex);
     
    338338    // increment the memory id safely.
    339339    pthread_mutex_lock(&memBlockListMutex);
    340     *(psMemoryId* ) & ptr->id = ++memid;
     340    *(psMemId* ) & ptr->id = ++memid;
    341341    pthread_mutex_unlock(&memBlockListMutex);
    342342
     
    448448 * Check for memory leaks.
    449449 */
    450 psS32 psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd, psBool persistence)
     450psS32 psMemCheckLeaks(psMemId id0, psMemBlock* ** arr, FILE * fd, psBool persistence)
    451451{
    452452    psS32 nleak = 0;
  • trunk/psLib/src/sysUtils/psMemory.h

    r4392 r4397  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-25 02:02:05 $
     14 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-25 03:32:42 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4949
    5050/// typedef for memory identification numbers.  Guaranteed to be some variety of integer.
    51 typedef psU64 psMemoryId;
     51typedef psU64 psMemId;
    5252
    5353/// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
     
    6969    psFreeFunc freeFcn;                 ///< deallocator.  If NULL, use generic deallocation.
    7070    size_t userMemorySize;             ///< the size of the user-portion of the memory block
    71     const psMemoryId id;               ///< a unique ID for this allocation
     71    const psMemId id;               ///< a unique ID for this allocation
    7272    const char *file;                  ///< set from __FILE__ in e.g. p_psAlloc
    7373    const psS32 lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
     
    8484 *  @ingroup memCallback
    8585 */
    86 typedef psMemoryId(*psMemAllocateCallback) (
     86typedef psMemId(*psMemAllocateCallback) (
    8787    const psMemBlock* ptr              ///< the psMemBlock just allocated
    8888);
     
    9393 *  @ingroup memCallback
    9494 */
    95 typedef psMemoryId(*psMemFreeCallback) (
     95typedef psMemId(*psMemFreeCallback) (
    9696    const psMemBlock* ptr              ///< the psMemBlock being freed
    9797);
     
    259259 */
    260260psS32 psMemCheckLeaks(
    261     psMemoryId id0,                    ///< don't list blocks with id < id0
     261    psMemId id0,                    ///< don't list blocks with id < id0
    262262    psMemBlock* ** arr,                ///< pointer to array of pointers to leaked blocks, or NULL
    263263    FILE * fd,                         ///< print list of leaks to fd (or NULL)
     
    394394 *  @ingroup memCallback
    395395 *
    396  *  @return psMemoryId                 the next memory ID to be used
    397  */
    398 psMemoryId psMemGetId(void);
     396 *  @return psMemId                 the next memory ID to be used
     397 */
     398psMemId psMemGetId(void);
    399399
    400400/** set p_psMemAllocateID to specific id
     
    407407 *  @ingroup memCallback
    408408 *
    409  *  @return psMemoryId
     409 *  @return psMemId
    410410 *
    411411 *  @see psMemAllocateCallbackSet
    412412 */
    413 psMemoryId psMemAllocateCallbackSetID(
    414     psMemoryId id                      ///< ID to set
     413psMemId psMemAllocateCallbackSetID(
     414    psMemId id                      ///< ID to set
    415415);
    416416
     
    424424 *  @ingroup memCallback
    425425 *
    426  *  @return psMemoryId                 the old p_psMemFreeID
     426 *  @return psMemId                 the old p_psMemFreeID
    427427 *
    428428 *  @see psMemFreeCallbackSet
    429429 */
    430 psMemoryId psMemFreeCallbackSetID(
    431     psMemoryId id                      ///< ID to set
     430psMemId psMemFreeCallbackSetID(
     431    psMemId id                      ///< ID to set
    432432);
    433433
  • trunk/psLib/src/sysUtils/sysUtils.i

    r3165 r4397  
    4040}
    4141
    42 psS32 psMemCheckLeaksToStderr(psMemoryId id0, psMemBlock*** arr, psBool persistence) {
     42psS32 psMemCheckLeaksToStderr(psMemId id0, psMemBlock*** arr, psBool persistence) {
    4343    return psMemCheckLeaks(id0, arr, stderr, persistence);
    4444}
    45 psS32 psMemCheckLeaksToStdout(psMemoryId id0, psMemBlock*** arr, psBool persistence) {
     45psS32 psMemCheckLeaksToStdout(psMemId id0, psMemBlock*** arr, psBool persistence) {
    4646    return psMemCheckLeaks(id0, arr, stdout, persistence);
    4747}
  • trunk/psLib/test/sysUtils/tst_psMemory.c

    r4308 r4397  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-06-17 23:44:22 $
     8*  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-06-25 03:32:42 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3030static psS32 TPrealloc( void );
    3131static psS32 TPallocCallback( void );
    32 static psMemoryId memAllocateCallback( const psMemBlock *ptr );
    33 static psMemoryId memFreeCallback( const psMemBlock *ptr );
     32static psMemId memAllocateCallback( const psMemBlock *ptr );
     33static psMemId memFreeCallback( const psMemBlock *ptr );
    3434static psS32 TPcheckLeaks( void );
    3535static psS32 TPmemCorruption( void );
     
    497497}
    498498
    499 psMemoryId memAllocateCallback( const psMemBlock *ptr )
     499psMemId memAllocateCallback( const psMemBlock *ptr )
    500500{
    501501    psLogMsg( __func__, PS_LOG_INFO, "block %lld was (re)allocated", ptr->id );
     
    504504}
    505505
    506 psMemoryId memFreeCallback( const psMemBlock *ptr )
     506psMemId memFreeCallback( const psMemBlock *ptr )
    507507{
    508508    psLogMsg( __func__, PS_LOG_INFO, "block %lld was freed", ptr->id );
Note: See TracChangeset for help on using the changeset viewer.