Changeset 9538 for trunk/psLib/src/sys/psMemory.c
- Timestamp:
- Oct 13, 2006, 11:13:48 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psMemory.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psMemory.c
r8812 r9538 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.8 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2006- 09-14 22:27:29$10 * @version $Revision: 1.86 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-10-13 21:13:48 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 24 24 #include "psMemory.h" 25 25 #include "psError.h" 26 #include "psAssert.h" 26 27 #include "psAbort.h" 27 28 #include "psLogMsg.h" … … 35 36 #include "psLine.h" 36 37 #include "psRegion.h" 37 38 #define P_PS_MEMMAGIC (psPtr )0xdeadbeef // Magic number in psMemBlock header39 38 40 39 #define P_PS_LARGE_BLOCK_SIZE 65536 // size where under, we try to recycle … … 274 273 psMemId psMemGetId(void) 275 274 { 276 psMemId id; 277 278 if (safeThreads) { 279 pthread_mutex_lock(&memIdMutex); 280 } 281 282 id = memid + 1; 283 284 if (safeThreads) { 285 pthread_mutex_unlock(&memIdMutex); 286 } 287 288 return id; 275 return psMemGetLastId() + 1; 289 276 } 290 277 … … 889 876 } 890 877 891 bool is_psType(psPtr ptr)892 {893 if (ptr == NULL) {894 return false;895 }896 psMemBlock* m = ((psMemBlock* ) ptr) - 1;897 if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {898 return false; //Probably not a psAllocated-Type899 } else {900 return true;901 }902 }903 904 878 bool psMemCheckType(psDataType type, 905 879 psPtr ptr) 906 880 { 907 if (!is_psType(ptr)) { 908 return false; 909 } 881 PS_ASSERT_PTR(ptr, false); 910 882 911 883 switch(type) {
Note:
See TracChangeset
for help on using the changeset viewer.
