Changeset 8fe650 in git
- Timestamp:
- May 2, 2006, 1:39:03 PM (17 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- fc11f4583f0780c252a03d9b7079efbb0029dbce
- Parents:
- c551fdc7a02e90492400d97decfdc027e6af25a9
- Location:
- omalloc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
omalloc/omAllocDecl.h
rc551fdc r8fe650 4 4 * Author: obachman (Olaf Bachmann) 5 5 * Created: 11/99 6 * Version: $Id: omAllocDecl.h,v 1. 8 2001-04-30 09:02:00Singular Exp $6 * Version: $Id: omAllocDecl.h,v 1.9 2006-05-02 11:38:43 Singular Exp $ 7 7 *******************************************************************/ 8 8 #ifndef OM_ALLOC_DECL_H 9 9 #define OM_ALLOC_DECL_H 10 11 #ifdef OM_NDEBUG 12 #if (SIZEOF_LONG == 8) 13 #define OM_T_FREE1 14 #define OM_T_FREE3 15 #define OM_T_STR 16 #define OM_T_ALLOC 17 #define OM_T_REALLOC 18 #endif 19 #endif 10 20 11 21 … … 19 29 #endif 20 30 21 #if !defined(OM_EMULATE_OMALLOC) && !defined(OM_NDEBUG) && (defined(OM_CHECK) || (defined(OM_HAVE_TRACK) && defined(OM_TRACK)))31 #if (!defined(OM_EMULATE_OMALLOC) && !defined(OM_NDEBUG) && (defined(OM_CHECK) || (defined(OM_HAVE_TRACK) && defined(OM_TRACK)))) || defined(OM_T1) 22 32 23 33 /******************************************************************* … … 39 49 #endif 40 50 51 #if !defined(OM_T_ALLOC) 41 52 #define omTypeAllocBin(type,addr,bin) addr=(type)_omDebugAlloc(bin,OM_FBIN|_OM_FKEEP,OM_CTFL) 42 53 #define omTypeAlloc0Bin(type,addr,bin) addr=(type)_omDebugAlloc(bin,OM_FBIN|OM_FZERO|_OM_FKEEP,OM_CTFL) … … 49 60 #define omAlloc0(size) _omDebugAlloc((void*)(size),OM_FSIZE|OM_FZERO|_OM_FKEEP,OM_CTFL) 50 61 62 #define omalloc(size) _omDebugAlloc((void*)(size),OM_FSIZE|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL) 63 #define omalloc0(size) _omDebugAlloc((void*)(size),OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL) 64 #define omcalloc(n,size)_omDebugAlloc((void*) ((size)*n),OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL) 65 66 #else 67 #define omTypeAllocBin(type,addr,bin) __omTypeAllocBin(type,addr,bin) 68 #define omTypeAlloc0Bin(type,addr,bin) __omTypeAlloc0Bin(type,addr,bin) 69 #define omAllocBin(bin) _omAllocBin(bin) 70 #define omAlloc0Bin(bin) _omAlloc0Bin(bin) 71 72 #define omTypeAlloc(type,addr,size) __omTypeAlloc(type,addr,size) 73 #define omTypeAlloc0(type,addr,size) __omTypeAlloc0(type,addr,size) 74 #define omAlloc(size) _omAlloc(size) 75 #define omAlloc0(size) _omAlloc0(size) 76 77 #define omalloc(size) _omalloc(size) 78 #define omalloc0(size) _omalloc0(size) 79 #define omcalloc(n,size)_omalloc0(n*size) 80 81 #endif 82 83 #if !defined(OM_T_REALLOC) 51 84 #define omTypeReallocBin(o_addr,o_bin,type,addr,bin) addr=(type)_omDebugRealloc(o_addr,o_bin,bin,OM_FBIN|_OM_FKEEP,OM_FBIN|_OM_FKEEP,OM_CTFL) 52 85 #define omTypeRealloc0Bin(o_addr,o_bin,type,addr,bin) addr=(type)_omDebugRealloc(o_addr,o_bin,bin,OM_FBIN|_OM_FKEEP,OM_FBIN|OM_FZERO|_OM_FKEEP,OM_CTFL) … … 64 97 #define omRealloc0(addr,size) _omDebugRealloc(addr,NULL,(void*)(size),_OM_FKEEP,OM_FSIZE|OM_FZERO,OM_CTFL) 65 98 66 #define omFreeBinAddr(addr) _omDebugFree(addr,NULL,OM_FBINADDR|_OM_FKEEP,OM_CFL)67 #define omFreeBin(addr,bin) _omDebugFree(addr,bin,OM_FBIN|_OM_FKEEP,OM_CFL)68 #define omFreeSize(addr,size) _omDebugFree(addr,(void*)(size),OM_FSIZE|_OM_FKEEP,OM_CFL)69 #define omFree(addr) _omDebugFree(addr,0,0,OM_CFL)70 71 72 #define omalloc(size) _omDebugAlloc((void*)(size),OM_FSIZE|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)73 #define omalloc0(size) _omDebugAlloc((void*)(size),OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)74 #define omcalloc(n,size)_omDebugAlloc((void*) ((size)*n),OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)75 76 99 #define omreallocSize(addr,o_size,size) _omDebugRealloc(addr,(void*)(o_size),(void*)(size),OM_FSIZE|OM_FSLOPPY|_OM_FKEEP,OM_FSIZE|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL) 77 100 #define omrealloc0Size(addr,o_size,size)_omDebugRealloc(addr,(void*)(o_size),(void*)(size),OM_FSIZE|OM_FSLOPPY|_OM_FKEEP,OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL) … … 79 102 #define omrealloc0(addr,size) _omDebugRealloc(addr,NULL,(void*)(size),OM_FSLOPPY|_OM_FKEEP,OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL) 80 103 104 #else 105 #define omTypeReallocBin(o_addr,o_bin,type,addr,bin) __omTypeReallocBin(o_addr,o_bin,type,addr,bin) 106 #define omTypeRealloc0Bin(o_addr,o_bin,type,addr,bin) __omTypeRealloc0Bin(o_addr,o_bin,type,addr,bin) 107 #define omReallocBin(o_addr,o_bin,bin) _omReallocBin(o_addr,o_bin,bin) 108 #define omRealloc0Bin(o_addr,o_bin,bin) _omRealloc0Bin(o_addr,o_bin,bin) 109 110 #define omTypeReallocSize(o_addr,o_size,type,addr,size) __omTypeReallocSize(o_addr,o_size,type,addr,size) 111 #define omTypeRealloc0Size(o_addr,o_size,type,addr,size) __omTypeRealloc0Size(o_addr,o_size,type,addr,size) 112 #define omReallocSize(addr,o_size,size) _omReallocSize(addr,o_size,size) 113 #define omRealloc0Size(addr,o_size,size) _omRealloc0Size(addr,o_size,size) 114 115 #define omTypeRealloc(o_addr,type,addr,size) __omTypeRealloc(o_addr,type,addr,size) 116 #define omTypeRealloc0(o_addr,type,addr,size) __omTypeRealloc0(o_addr,type,addr,size) 117 #define omRealloc(addr,size) _omRealloc(addr,size) 118 #define omRealloc0(addr,size) _omRealloc0(addr,size) 119 120 #define omreallocSize(addr,o_size,size) _omreallocSize(addr,o_size,size) 121 #define omrealloc0Size(addr,o_size,size)_omrealloc0Size(addr,o_size,size) 122 #define omrealloc(addr,size) _omrealloc(addr, size) 123 #define omrealloc0(addr,size) _omrealloc0(addr, size) 124 125 #endif 126 127 #if !defined(OM_T_FREE1) 128 #define omFreeBinAddr(addr) _omDebugFree(addr,NULL,OM_FBINADDR|_OM_FKEEP,OM_CFL) 129 #define omFreeBin(addr,bin) _omDebugFree(addr,bin,OM_FBIN|_OM_FKEEP,OM_CFL) 130 #else 131 #define omFreeBinAddr(addr) __omFreeBinAddr(addr) 132 #define omFreeBin(addr,bin) __omFreeBinAddr(addr) 133 #endif 134 135 #if !defined(OM_T_FREE2) 136 #define omFreeSize(addr,size) _omDebugFree(addr,(void*)(size),OM_FSIZE|_OM_FKEEP,OM_CFL) 81 137 #define omfreeSize(addr,size) _omDebugFree(addr,(void*)(size),OM_FSIZE|OM_FSLOPPY|_OM_FKEEP,OM_CFL) 138 #else 139 #define omFreeSize(addr,size) __omFreeSize(addr,size) 140 #define omfreeSize(addr,size) do {if (addr && size) omFreeSize(addr, size);} while (0) 141 #endif 142 143 #if !defined(OM_T_FREE3) 144 #define omFree(addr) _omDebugFree(addr,0,0,OM_CFL) 82 145 #define omfree(addr) _omDebugFree(addr,NULL,OM_FSLOPPY|_OM_FKEEP,OM_CFL) 83 146 #else 147 #define omFree(addr) __omFree(addr) 148 #define omfree(addr) do {if (addr) omFree(addr);} while (0) 149 #endif 150 151 #if !defined(OM_T_STR) 84 152 #define omStrDup(s) _omDebugStrDup(s,OM_TFL) 85 153 #define omMemDup(addr) _omDebugMemDup(addr,_OM_FKEEP,OM_CTFL) 154 #else 155 #define omStrDup(s) _omStrDup(s) 156 #define omMemDup(s) _omMemDup(s) 157 #endif 86 158 87 159 #define omDebugBinAddr(addr) _omDebugAddr(addr,NULL,OM_FBINADDR,OM_CFL) -
omalloc/omAllocPrivate.h
rc551fdc r8fe650 5 5 * Author: obachman (Olaf Bachmann) 6 6 * Created: 11/99 7 * Version: $Id: omAllocPrivate.h,v 1. 7 2003-06-20 16:40:58Singular Exp $7 * Version: $Id: omAllocPrivate.h,v 1.8 2006-05-02 11:39:02 Singular Exp $ 8 8 *******************************************************************/ 9 9 #ifndef OM_ALLOC_PRIVATE_H … … 123 123 do \ 124 124 { \ 125 if ((page)->used_blocks > 0 )\125 if ((page)->used_blocks > 0L) \ 126 126 { \ 127 127 *((void**) (addr)) = (page)->current; \ … … 283 283 do \ 284 284 { \ 285 if ( size <= OM_MAX_BLOCK_SIZE || omIsBinPageAddr(addr))\285 if ((size <= OM_MAX_BLOCK_SIZE) || omIsBinPageAddr(addr)) \ 286 286 { \ 287 __omFreeBinAddr(addr); 287 __omFreeBinAddr(addr); \ 288 288 } \ 289 289 else \ -
omalloc/om_Alloc.c
rc551fdc r8fe650 4 4 * Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) 5 5 * Created: 11/99 6 * Version: $Id: om_Alloc.c,v 1. 2 2001-04-30 09:02:12Singular Exp $6 * Version: $Id: om_Alloc.c,v 1.3 2006-05-02 11:39:03 Singular Exp $ 7 7 *******************************************************************/ 8 8 #ifndef OM_ALLOC_C … … 167 167 { 168 168 omBin bin; 169 omAssume(page->used_blocks <= 0 );169 omAssume(page->used_blocks <= 0L); 170 170 171 171 #ifdef OM_HAVE_TRACK 172 if (page->used_blocks < 0 )172 if (page->used_blocks < 0L) 173 173 { 174 174 omFreeTrackAddr(addr); … … 178 178 179 179 bin = omGetBinOfPage(page); 180 if ( page->current != NULL || bin->max_blocks <= 1)180 if ((page->current != NULL) || (bin->max_blocks <= 1)) 181 181 { 182 182 // all blocks of page are now collected
Note: See TracChangeset
for help on using the changeset viewer.