IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

revised psMemory structs in accordance with psLib SDRS rev. 15. added psDataType

File:
1 edited

Legend:

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

    r4401 r4444  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-06-27 20:38:12 $
     10*  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2005-07-01 03:57:39 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8484/*
    8585 * Default callback for both allocate and free. Note that the
    86  * value of p_psMemAllocateID/p_psMemFreeID is incremented
     86 * value of p_psMemAllocID/p_psMemFreeID is incremented
    8787 * by the return value (so returning 0 means that the callback
    8888 * isn't resignalled)
    8989 */
    90 static psMemId memAllocateCallbackDefault(const psMemBlock* ptr)
    91 {
    92     static psMemId incr = 0; // "p_psMemAllocateID += incr"
     90static psMemId memAllocCallbackDefault(const psMemBlock* ptr)
     91{
     92    static psMemId incr = 0; // "p_psMemAllocID += incr"
    9393
    9494    return incr;
     
    102102}
    103103
    104 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, psS32 lineno)
     104static void memProblemCallbackDefault( psMemBlock* ptr, const char *file, unsigned int lineno)
    105105{
    106106    if (ptr->refCounter < 1) {
     
    158158 * The default callbacks
    159159 */
    160 static psMemAllocateCallback memAllocateCallback = memAllocateCallbackDefault;
     160static psMemAllocCallback memAllocCallback = memAllocCallbackDefault;
    161161static psMemFreeCallback memFreeCallback = memFreeCallbackDefault;
    162162static psMemProblemCallback memProblemCallback = memProblemCallbackDefault;
     
    194194 * Call the callbacks when these IDs are allocated/freed
    195195 */
    196 psMemId p_psMemAllocateID = 0;       // notify user this block is allocated
     196psMemId p_psMemAllocID = 0;       // notify user this block is allocated
    197197psMemId p_psMemFreeID = 0;   // notify user this block is freed
    198198
    199 psMemId psMemAllocateCallbackSetID(psMemId id)
    200 {
    201     psMemId old = p_psMemAllocateID;
    202 
    203     p_psMemAllocateID = id;
     199psMemId psMemAllocCallbackSetID(psMemId id)
     200{
     201    psMemId old = p_psMemAllocID;
     202
     203    p_psMemAllocID = id;
    204204
    205205    return old;
     
    215215}
    216216
    217 psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func)
    218 {
    219     psMemFreeCallback old = memAllocateCallback;
     217psMemAllocCallback psMemAllocCallbackSet(psMemAllocCallback func)
     218{
     219    psMemFreeCallback old = memAllocCallback;
    220220
    221221    if (func != NULL) {
    222         memAllocateCallback = func;
     222        memAllocCallback = func;
    223223    } else {
    224         memAllocateCallback = memAllocateCallbackDefault;
     224        memAllocCallback = memAllocCallbackDefault;
    225225    }
    226226
     
    286286}
    287287
    288 psPtr p_psAlloc(size_t size, const char *file, psS32 lineno)
     288psPtr p_psAlloc(size_t size, const char *file, unsigned int lineno)
    289289{
    290290
     
    363363
    364364    // Did the user ask to be informed about this allocation?
    365     if (ptr->id == p_psMemAllocateID) {
    366         p_psMemAllocateID += memAllocateCallback(ptr);
     365    if (ptr->id == p_psMemAllocID) {
     366        p_psMemAllocID += memAllocCallback(ptr);
    367367    }
    368368    // And return the user the memory that they allocated
     
    370370}
    371371
    372 psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32 lineno)
     372psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, unsigned int lineno)
    373373{
    374374    size = (size < recycleBinSize[0]) ? recycleBinSize[0] : size; // set the minimum size to allocate
     
    416416
    417417        // Did the user ask to be informed about this allocation?
    418         if (ptr->id == p_psMemAllocateID) {
    419             p_psMemAllocateID += memAllocateCallback(ptr);
     418        if (ptr->id == p_psMemAllocID) {
     419            p_psMemAllocID += memAllocCallback(ptr);
    420420        }
    421421
     
    424424}
    425425
    426 void p_psFree(psPtr vptr, const char *file, psS32 lineno)
     426void p_psFree(psPtr vptr, const char *file, unsigned int lineno)
    427427{
    428428    if (vptr == NULL) {
Note: See TracChangeset for help on using the changeset viewer.