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

Function omtTestAlloc

omalloc/omtTestAlloc.c:33–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32#ifdef HAVE_OMALLOC
33void omtTestAlloc(omMemCell cell, unsigned long spec)
34{
35 size_t size = GET_SIZE(spec);
36 void* addr;
37 omBin bin = NULL;
38 omBin orig_bin = NULL;
39
40 if (IS_BIN(spec) && (size <= OM_MAX_BLOCK_SIZE || IS_SPEC_BIN(spec)))
41 {
42 if (IS_SPEC_BIN(spec))
43 {
44 if (IS_ALIGNED(spec))
45 bin = omGetAlignedSpecBin(size);
46 else
47 bin = omGetSpecBin(size);
48 }
49 else
50 {
51 if (IS_ALIGNED(spec))
52 bin = omSmallSize2AlignedBin(size);
53 else
54 bin = omSmallSize2Bin(size);
55 }
56
57 if (IS_STICKY_BIN(spec))
58 {
59 orig_bin = bin;
60 bin = omtGetStickyBin(bin);
61 }
62
63 if (IS_INLINE(spec))
64 {
65 if (IS_ZERO(spec))
66 addr = omAlloc0Bin(bin);
67 else
68 addr = omAllocBin(bin);
69 }
70 else
71 {
72 if (IS_ZERO(spec))
73 omTypeAlloc0Bin(void*, addr, bin);
74 else
75 omTypeAllocBin(void*, addr, bin);
76 }
77 }
78 else
79 {
80 if (IS_INLINE(spec))
81 {
82 if (IS_ZERO(spec))
83 {
84 if (IS_ALIGNED(spec))
85 {
86 if (IS_SLOPPY(spec))
87 addr = omalloc0(size);
88 else
89 addr = omAlloc0Aligned(size);
90 }

Callers 1

TestAllocFunction · 0.85

Calls 8

omGetSpecBinFunction · 0.85
omtGetStickyBinFunction · 0.85
omAlloc0BinFunction · 0.85
omAllocBinFunction · 0.85
omalloc0Function · 0.85
omAlloc0Function · 0.85
InitCellAddrContentFunction · 0.85
omtTestDebugFunction · 0.85

Tested by

no test coverage detected