MCPcopy Create free account
hub / github.com/cpputest/cpputest / getAllocationString

Method getAllocationString

src/CppUTestExt/CodeMemoryReportFormatter.cpp:122–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122SimpleString CodeMemoryReportFormatter::getAllocationString(TestMemoryAllocator* allocator, const SimpleString& variableName, size_t size)
123{
124 if (isNewAllocator(allocator))
125 return StringFromFormat("char* %s = new char[%lu]; /* using %s */", variableName.asCharString(), (unsigned long) size, allocator->alloc_name());
126 else
127 return StringFromFormat("void* %s = malloc(%lu);", variableName.asCharString(), (unsigned long) size);
128}
129
130SimpleString CodeMemoryReportFormatter::getDeallocationString(TestMemoryAllocator* allocator, const SimpleString& variableName, const char* file, size_t line)
131{

Callers

nothing calls this directly

Calls 3

StringFromFormatFunction · 0.85
asCharStringMethod · 0.80
alloc_nameMethod · 0.45

Tested by

no test coverage detected