Changeset 446 for trunk/archive/pslib/src/Utils/memory.c
- Timestamp:
- Apr 19, 2004, 9:41:51 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/src/Utils/memory.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/src/Utils/memory.c
r329 r446 52 52 return NULL; 53 53 } 54 static psMemExhaustedC allbackmemExhaustedCB = memExhaustedCB0;55 56 psMemExhaustedC allback psMemExhaustedSetCB(psMemExhaustedCallbackfunc)57 { 58 psMemExhaustedC allbackold = memExhaustedCB;54 static psMemExhaustedCB memExhaustedCB = memExhaustedCB0; 55 56 psMemExhaustedCB psMemExhaustedSetCB(psMemExhaustedCB func) 57 { 58 psMemExhaustedCB old = memExhaustedCB; 59 59 60 60 memExhaustedCB = (func != NULL) ? func : memExhaustedCB0; … … 89 89 } 90 90 } 91 static psMemProblemC allbackmemProblemCB = memProblemCB0;92 93 psMemProblemC allback psMemProblemSetCB(psMemProblemCallbackfunc)94 { 95 psMemProblemC allbackold = memProblemCB;91 static psMemProblemCB memProblemCB = memProblemCB0; 92 93 psMemProblemCB psMemProblemSetCB(psMemProblemCB func) 94 { 95 psMemProblemCB old = memProblemCB; 96 96 97 97 memProblemCB = (func != NULL) ? func : memProblemCB0; … … 129 129 * isn't resignalled) 130 130 */ 131 static intmemAllocateCB0(const psMemBlock *ptr)131 static long memAllocateCB0(const psMemBlock *ptr) 132 132 { 133 133 static int incr = 0; // "p_psMemAllocateID += incr" … … 138 138 } 139 139 140 static intmemFreeCB0(const psMemBlock *ptr)140 static long memFreeCB0(const psMemBlock *ptr) 141 141 { 142 142 static int incr = 0; // "p_psMemFreeID += incr" … … 150 150 * The default callbacks, and the routines to change them 151 151 */ 152 static psMem CallbackmemAllocateCB = memAllocateCB0;153 static psMem CallbackmemFreeCB = memFreeCB0;154 155 psMem Callback psMemAllocateSetCB(psMemCallbackfunc)156 { 157 psMem Callbackold = memAllocateCB;152 static psMemAllocateCB memAllocateCB = memAllocateCB0; 153 static psMemFreeCB memFreeCB = memFreeCB0; 154 155 psMemAllocateCB psMemAllocateSetCB(psMemAllocateCB func) 156 { 157 psMemAllocateCB old = memAllocateCB; 158 158 159 159 memAllocateCB = (func != NULL) ? func : memAllocateCB0; … … 162 162 } 163 163 164 psMem Callback psMemFreeSetCB(psMemCallbackfunc)165 { 166 psMem Callbackold = memFreeCB;164 psMemFreeCB psMemFreeSetCB(psMemFreeCB func) 165 { 166 psMemFreeCB old = memFreeCB; 167 167 168 168 memFreeCB = (func != NULL) ? func : memFreeCB0; … … 208 208 } 209 209 210 if (m-> magic0 != P_PS_MEMMAGIC || m->magic!= P_PS_MEMMAGIC) {210 if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) { 211 211 if (!quiet) { 212 212 psError(__func__, PS_ERR_MEMORY_CORRUPTION, PS_NEW_ERROR, … … 261 261 ptr->file = file; 262 262 *(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 264 265 265 266 ptr->refCounter = 1; // one user so far
Note:
See TracChangeset
for help on using the changeset viewer.
