Skip to content

Commit

Permalink
Renamed "addr" parameters as "caller"
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonzalezdr committed Mar 26, 2018
1 parent d2d9e04 commit 175e585
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 84 deletions.
20 changes: 10 additions & 10 deletions include/CppUTest/MemoryLeakDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,18 @@ class MemoryLeakOutputStringBuffer
struct MemoryLeakDetectorNode
{
MemoryLeakDetectorNode() :
size_(0), number_(0), memory_(NULLPTR), file_(NULLPTR), line_(0), addr_(NULLPTR), allocator_(NULLPTR), period_(mem_leak_period_enabled), next_(NULLPTR)
size_(0), number_(0), memory_(NULLPTR), file_(NULLPTR), line_(0), caller_(NULLPTR), allocator_(NULLPTR), period_(mem_leak_period_enabled), next_(NULLPTR)
{
}

void init(char* memory, unsigned number, size_t size, TestMemoryAllocator* allocator, MemLeakPeriod period, const char* file, int line, void *addr);
void init(char* memory, unsigned number, size_t size, TestMemoryAllocator* allocator, MemLeakPeriod period, const char* file, int line, void *caller);

size_t size_;
unsigned number_;
char* memory_;
const char* file_;
int line_;
void *addr_;
void *caller_;
TestMemoryAllocator* allocator_;
MemLeakPeriod period_;

Expand Down Expand Up @@ -207,10 +207,10 @@ class MemoryLeakDetector
void clearAllAccounting(MemLeakPeriod period);

char* allocMemory(TestMemoryAllocator* allocator, size_t size, bool allocatNodesSeperately = false);
char* allocMemory(TestMemoryAllocator* allocator, size_t size, const char* file, int line, void *addr, bool allocatNodesSeperately = false);
char* allocMemory(TestMemoryAllocator* allocator, size_t size, const char* file, int line, void *caller, bool allocatNodesSeperately = false);
void deallocMemory(TestMemoryAllocator* allocator, void* memory, bool allocatNodesSeperately = false);
void deallocMemory(TestMemoryAllocator* allocator, void* memory, const char* file, int line, void *addr, bool allocatNodesSeperately = false);
char* reallocMemory(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, void *addr, bool allocatNodesSeperately = false);
void deallocMemory(TestMemoryAllocator* allocator, void* memory, const char* file, int line, void *caller, bool allocatNodesSeperately = false);
char* reallocMemory(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, void *caller, bool allocatNodesSeperately = false);

void invalidateMemory(char* memory);
void removeMemoryLeakInformationWithoutCheckingOrDeallocatingTheMemoryButDeallocatingTheAccountInformation(TestMemoryAllocator* allocator, void* memory, bool allocatNodesSeperately);
Expand All @@ -231,21 +231,21 @@ class MemoryLeakDetector
unsigned allocationSequenceNumber_;
SimpleMutex* mutex_;

char* allocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, size_t size, const char* file, int line, void *addr, bool allocatNodesSeperately);
char* reallocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, void *addr, bool allocatNodesSeperately);
char* allocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, size_t size, const char* file, int line, void *caller, bool allocatNodesSeperately);
char* reallocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, void *caller, bool allocatNodesSeperately);
MemoryLeakDetectorNode* createMemoryLeakAccountingInformation(TestMemoryAllocator* allocator, size_t size, char* memory, bool allocatNodesSeperately);


bool validMemoryCorruptionInformation(char* memory);
bool matchingAllocation(TestMemoryAllocator *alloc_allocator, TestMemoryAllocator *free_allocator);

void storeLeakInformation(MemoryLeakDetectorNode * node, char *new_memory, size_t size, TestMemoryAllocator *allocator, const char *file, int line, void *addr);
void storeLeakInformation(MemoryLeakDetectorNode * node, char *new_memory, size_t size, TestMemoryAllocator *allocator, const char *file, int line, void *caller);
void ConstructMemoryLeakReport(MemLeakPeriod period);

size_t sizeOfMemoryWithCorruptionInfo(size_t size);
MemoryLeakDetectorNode* getNodeFromMemoryPointer(char* memory, size_t size);

char* reallocateMemoryAndLeakInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, void *addr, bool allocatNodesSeperately);
char* reallocateMemoryAndLeakInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, void *caller, bool allocatNodesSeperately);

void addMemoryCorruptionInformation(char* memory);
void checkForCorruption(MemoryLeakDetectorNode* node, const char* file, int line, TestMemoryAllocator* allocator, bool allocateNodesSeperately);
Expand Down
12 changes: 6 additions & 6 deletions include/CppUTest/TestMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class TestMemoryAllocator
virtual ~TestMemoryAllocator();
bool hasBeenDestroyed();

virtual char* alloc_memory(size_t size, const char* file, int line, void *addr);
virtual void free_memory(char* memory, const char* file, int line, void *addr);
virtual char* alloc_memory(size_t size, const char* file, int line, void *caller);
virtual void free_memory(char* memory, const char* file, int line, void *caller);

virtual const char* name() const;
virtual const char* alloc_name() const;
Expand Down Expand Up @@ -82,16 +82,16 @@ class CrashOnAllocationAllocator : public TestMemoryAllocator

virtual void setNumberToCrashOn(unsigned allocationToCrashOn);

virtual char* alloc_memory(size_t size, const char* file, int line, void *addr) _override;
virtual char* alloc_memory(size_t size, const char* file, int line, void *caller) _override;
};


class NullUnknownAllocator: public TestMemoryAllocator
{
public:
NullUnknownAllocator();
virtual char* alloc_memory(size_t size, const char* file, int line, void *addr) _override;
virtual void free_memory(char* memory, const char* file, int line, void *addr) _override;
virtual char* alloc_memory(size_t size, const char* file, int line, void *caller) _override;
virtual void free_memory(char* memory, const char* file, int line, void *caller) _override;

static TestMemoryAllocator* defaultAllocator();
};
Expand All @@ -103,7 +103,7 @@ class FailableMemoryAllocator: public TestMemoryAllocator
public:
FailableMemoryAllocator(const char* name_str = "failable alloc", const char* alloc_name_str = "alloc", const char* free_name_str = "free");

virtual char* alloc_memory(size_t size, const char* file, int line, void *addr);
virtual char* alloc_memory(size_t size, const char* file, int line, void *caller);
virtual char* allocMemoryLeakNode(size_t size);

virtual void failAllocNumber(int number);
Expand Down
4 changes: 2 additions & 2 deletions include/CppUTestExt/CodeMemoryReportFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class CodeMemoryReportFormatter : public MemoryReportFormatter
virtual void report_test_start(TestResult* result, UtestShell& test) _override;
virtual void report_test_end(TestResult* result, UtestShell& test) _override;

virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, int line, void *addr) _override;
virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, int line, void *addr) _override;
virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, int line, void *caller) _override;
virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, int line, void *caller) _override;

private:

Expand Down
4 changes: 2 additions & 2 deletions include/CppUTestExt/MemoryReportAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class MemoryReportAllocator : public TestMemoryAllocator

virtual TestMemoryAllocator* getRealAllocator();

virtual char* alloc_memory(size_t size, const char* file, int line, void *addr) _override;
virtual void free_memory(char* memory, const char* file, int line, void *addr) _override;
virtual char* alloc_memory(size_t size, const char* file, int line, void *caller) _override;
virtual void free_memory(char* memory, const char* file, int line, void *caller) _override;

virtual const char* name() const _override;
virtual const char* alloc_name() const _override;
Expand Down
8 changes: 4 additions & 4 deletions include/CppUTestExt/MemoryReportFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class MemoryReportFormatter
virtual void report_test_start(TestResult* result, UtestShell& test)=0;
virtual void report_test_end(TestResult* result, UtestShell& test)=0;

virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, int line, void *addr)=0;
virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, int line, void *addr)=0;
virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, int line, void *caller)=0;
virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, int line, void *caller)=0;
};

class NormalMemoryReportFormatter : public MemoryReportFormatter
Expand All @@ -58,8 +58,8 @@ class NormalMemoryReportFormatter : public MemoryReportFormatter
virtual void report_test_start(TestResult* result, UtestShell& test) _override;
virtual void report_test_end(TestResult* result, UtestShell& test) _override;

virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, int line, void *addr) _override;
virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, int line, void *addr) _override;
virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, int line, void *caller) _override;
virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, int line, void *caller) _override;
};

#endif
Loading

0 comments on commit 175e585

Please sign in to comment.