Skip to content

Commit

Permalink
Merge 6485b75 into 3ddc0fb
Browse files Browse the repository at this point in the history
  • Loading branch information
basvodde committed May 9, 2020
2 parents 3ddc0fb + 6485b75 commit 3118732
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions include/CppUTest/SimpleString.h
Expand Up @@ -109,10 +109,10 @@ class SimpleString

void deallocateInternalBuffer();
void setInternalBufferAsEmptyString();
void setInternalBufferToNewBuffer(size_t size);
void setInternalBufferTo(char* buffer, size_t size);
void setInternalBufferToNewBuffer(size_t bufferSize);
void setInternalBufferTo(char* buffer, size_t bufferSize);
void copyBufferToNewInternalBuffer(const char* otherBuffer);
void copyBufferToNewInternalBuffer(const char* otherBuffer, size_t size);
void copyBufferToNewInternalBuffer(const char* otherBuffer, size_t bufferSize);
void copyBufferToNewInternalBuffer(const SimpleString& otherBuffer);

char *buffer_;
Expand Down
2 changes: 1 addition & 1 deletion include/CppUTest/StandardCLibrary.h
Expand Up @@ -30,7 +30,7 @@
/* Needed for ... */
#include <stdarg.h>

//Kludge to get a va_copy in VC++ V6 and in GCC 98
/* Kludge to get a va_copy in VC++ V6 and in GCC 98 */
#ifndef va_copy
#ifdef __GNUC__
#define va_copy __va_copy
Expand Down
12 changes: 6 additions & 6 deletions src/CppUTest/SimpleString.cpp
Expand Up @@ -247,28 +247,28 @@ void SimpleString::setInternalBufferAsEmptyString()
buffer_ = getEmptyString();
}

void SimpleString::copyBufferToNewInternalBuffer(const char* otherBuffer, size_t size)
void SimpleString::copyBufferToNewInternalBuffer(const char* otherBuffer, size_t bufferSize)
{
deallocateInternalBuffer();

bufferSize_ = size;
bufferSize_ = bufferSize;
buffer_ = copyToNewBuffer(otherBuffer, bufferSize_);
}

void SimpleString::setInternalBufferToNewBuffer(size_t size)
void SimpleString::setInternalBufferToNewBuffer(size_t bufferSize)
{
deallocateInternalBuffer();

bufferSize_ = size;
bufferSize_ = bufferSize;
buffer_ = allocStringBuffer(bufferSize_, __FILE__, __LINE__);
buffer_[0] = '\0';
}

void SimpleString::setInternalBufferTo(char* buffer, size_t size)
void SimpleString::setInternalBufferTo(char* buffer, size_t bufferSize)
{
deallocateInternalBuffer();

bufferSize_ = size;
bufferSize_ = bufferSize;
buffer_ = buffer;
}

Expand Down
22 changes: 11 additions & 11 deletions src/CppUTest/TestMemoryAllocator.cpp
Expand Up @@ -552,22 +552,22 @@ size_t MemoryAccountant::maximumAllocationAtATimeOfSize(size_t size) const

size_t MemoryAccountant::totalAllocations() const
{
size_t totalAllocations = 0;
size_t theTotalAllocations = 0;

for (MemoryAccountantAllocationNode* node = head_; node; node = node->next_)
totalAllocations += node->allocations_;
theTotalAllocations += node->allocations_;

return totalAllocations;
return theTotalAllocations;
}

size_t MemoryAccountant::totalDeallocations() const
{
size_t totalDeallocations = 0;
size_t theTotalDeallocations = 0;

for (MemoryAccountantAllocationNode* node = head_; node; node = node->next_)
totalDeallocations += node->deallocations_;
theTotalDeallocations += node->deallocations_;

return totalDeallocations;
return theTotalDeallocations;
}

SimpleString MemoryAccountant::reportNoAllocations() const
Expand Down Expand Up @@ -606,16 +606,16 @@ SimpleString MemoryAccountant::report() const
if (head_ == NULLPTR)
return reportNoAllocations();

SimpleString report = reportTitle() + reportHeader();
SimpleString accountantReport = reportTitle() + reportHeader();

for (MemoryAccountantAllocationNode* node = head_; node; node = node->next_)
report += StringFromFormat(MEMORY_ACCOUNTANT_ROW_FORMAT, stringSize(node->size_).asCharString(), (int) node->allocations_, (int) node->deallocations_, (int) node->maxAllocations_);
accountantReport += StringFromFormat(MEMORY_ACCOUNTANT_ROW_FORMAT, stringSize(node->size_).asCharString(), (int) node->allocations_, (int) node->deallocations_, (int) node->maxAllocations_);

return report + reportFooter();
return accountantReport + reportFooter();
}

AccountingTestMemoryAllocator::AccountingTestMemoryAllocator(MemoryAccountant& accountant, TestMemoryAllocator* originalAllocator)
: accountant_(accountant), originalAllocator_(originalAllocator), head_(NULLPTR)
AccountingTestMemoryAllocator::AccountingTestMemoryAllocator(MemoryAccountant& accountant, TestMemoryAllocator* origAllocator)
: accountant_(accountant), originalAllocator_(origAllocator), head_(NULLPTR)
{
}

Expand Down

0 comments on commit 3118732

Please sign in to comment.