IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 19, 2004, 9:41:51 AM (22 years ago)
Author:
rhl
Message:

Fixed up code for changes in organisation and APIs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/src/Utils/memory.c

    r329 r446  
    5252    return NULL;
    5353}
    54 static psMemExhaustedCallback memExhaustedCB = memExhaustedCB0;
    55 
    56 psMemExhaustedCallback psMemExhaustedSetCB(psMemExhaustedCallback func)
    57 {
    58     psMemExhaustedCallback old = memExhaustedCB;
     54static psMemExhaustedCB memExhaustedCB = memExhaustedCB0;
     55
     56psMemExhaustedCB psMemExhaustedSetCB(psMemExhaustedCB func)
     57{
     58    psMemExhaustedCB old = memExhaustedCB;
    5959
    6060    memExhaustedCB = (func != NULL) ? func : memExhaustedCB0;
     
    8989    }
    9090}
    91 static psMemProblemCallback memProblemCB = memProblemCB0;
    92 
    93 psMemProblemCallback psMemProblemSetCB(psMemProblemCallback func)
    94 {
    95     psMemProblemCallback old = memProblemCB;
     91static psMemProblemCB memProblemCB = memProblemCB0;
     92
     93psMemProblemCB psMemProblemSetCB(psMemProblemCB func)
     94{
     95    psMemProblemCB old = memProblemCB;
    9696
    9797    memProblemCB = (func != NULL) ? func : memProblemCB0;
     
    129129 * isn't resignalled)
    130130 */
    131 static int memAllocateCB0(const psMemBlock *ptr)
     131static long memAllocateCB0(const psMemBlock *ptr)
    132132{
    133133    static int incr = 0;                // "p_psMemAllocateID += incr"
     
    138138}
    139139
    140 static int memFreeCB0(const psMemBlock *ptr)
     140static long memFreeCB0(const psMemBlock *ptr)
    141141{
    142142    static int incr = 0;                // "p_psMemFreeID += incr"
     
    150150 * The default callbacks, and the routines to change them
    151151 */
    152 static psMemCallback memAllocateCB = memAllocateCB0;
    153 static psMemCallback memFreeCB = memFreeCB0;
    154 
    155 psMemCallback psMemAllocateSetCB(psMemCallback func)
    156 {
    157     psMemCallback old = memAllocateCB;
     152static psMemAllocateCB memAllocateCB = memAllocateCB0;
     153static psMemFreeCB memFreeCB = memFreeCB0;
     154
     155psMemAllocateCB psMemAllocateSetCB(psMemAllocateCB func)
     156{
     157    psMemAllocateCB old = memAllocateCB;
    158158
    159159    memAllocateCB = (func != NULL) ? func : memAllocateCB0;
     
    162162}
    163163
    164 psMemCallback psMemFreeSetCB(psMemCallback func)
    165 {
    166     psMemCallback old = memFreeCB;
     164psMemFreeCB psMemFreeSetCB(psMemFreeCB func)
     165{
     166    psMemFreeCB old = memFreeCB;
    167167
    168168    memFreeCB = (func != NULL) ? func : memFreeCB0;
     
    208208    }
    209209   
    210     if (m->magic0 != P_PS_MEMMAGIC || m->magic != P_PS_MEMMAGIC) {
     210    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {
    211211        if (!quiet) {
    212212            psError(__func__, PS_ERR_MEMORY_CORRUPTION, PS_NEW_ERROR,
     
    261261    ptr->file = file;
    262262    *(int *)&ptr->lineno = lineno;
    263     *(void **)&ptr->magic0 = *(void **)&ptr->magic = P_PS_MEMMAGIC;
     263    *(void **)&ptr->startblock = *(void **)&ptr->endblock = P_PS_MEMMAGIC;
     264    ptr->endpost = &ptr->endblock;      // should point just beyond allocated memory XXX
    264265
    265266    ptr->refCounter = 1;                // one user so far
Note: See TracChangeset for help on using the changeset viewer.