MCPcopy Create free account
hub / github.com/Singular/Singular / __omDebugAlloc

Function __omDebugAlloc

omalloc/omDebug.c:304–350  ·  view source on GitHub ↗

* * Second level _omDebug alloc/free routines: do the actual work * *******************************************************************/

Source from the content-addressed store, hash-verified

302 *
303 *******************************************************************/
304static void* __omDebugAlloc(void* size_bin, omTrackFlags_t flags, char track, OM_FLR_DECL)
305{
306 void* o_addr;
307
308#ifdef OM_HAVE_TRACK
309 if (track > 0)
310 {
311 o_addr = omAllocTrackAddr(size_bin, flags, track, OM_FLR_VAL);
312 }
313 else
314#endif
315 {
316 if (flags & OM_FBIN)
317 {
318 omBin bin = (omBin) size_bin;
319
320 if (flags & OM_FZERO)
321 __omTypeAlloc0Bin(void*, o_addr, bin);
322 else
323 __omTypeAllocBin(void*, o_addr, bin);
324 }
325 else
326 {
327 size_t o_size = (flags & OM_FBIN ? ((omBin)size_bin)->sizeW << LOG_SIZEOF_LONG : (size_bin != NULL ? (size_t) size_bin: 1));
328 if (flags & OM_FZERO)
329 {
330#ifdef OM_ALIGNMENT_NEEDS_WORK
331 if (flags & OM_FALIGN)
332 __omTypeAlloc0Aligned(void*, o_addr, o_size);
333 else
334#endif
335 __omTypeAlloc0(void*, o_addr, o_size);
336 }
337 else
338 {
339#ifdef OM_ALIGNMENT_NEEDS_WORK
340 if (flags & OM_FALIGN)
341 __omTypeAllocAligned(void*, o_addr, o_size);
342 else
343#endif
344 __omTypeAlloc(void*, o_addr, o_size);
345 }
346 }
347 }
348
349 return o_addr;
350}
351
352static void* __omDebugRealloc(void* old_addr, void* old_size_bin, void* new_size_bin,
353 omError_t old_status, omTrackFlags_t old_flags, omTrackFlags_t new_flags,

Callers 4

_omDebugAllocFunction · 0.85
_omDebugMemDupFunction · 0.85
_omDebugStrDupFunction · 0.85
__omDebugReallocFunction · 0.85

Calls 1

omAllocTrackAddrFunction · 0.85

Tested by

no test coverage detected