From a12e588079700d55a0b788fea2df7727c2e41f52 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 27 Mar 2022 17:42:26 +0200 Subject: Removed MemDebug from FoundationEx --- FoundationEx/Text.cpp | 89 --------------------------------------------------- 1 file changed, 89 deletions(-) (limited to 'FoundationEx/Text.cpp') diff --git a/FoundationEx/Text.cpp b/FoundationEx/Text.cpp index 235bbaa..e73149a 100644 --- a/FoundationEx/Text.cpp +++ b/FoundationEx/Text.cpp @@ -11,7 +11,6 @@ Implementation of the Text class */ -#include "MemDebug.h" #include "Text.h" #include "stdio.h" #include @@ -26,11 +25,7 @@ TextRep TextRep::nullrep; TextRep::TextRep() : ref(1234567), data(0), length(0), hash(0), sensitive(true) { -#ifdef MEM_DEBUG - data = new(__FILE__,__LINE__) char[4]; -#else data = new char[4]; -#endif if (data) ZeroMemory(data, 4); @@ -46,11 +41,7 @@ TextRep::TextRep(const char* s) { if (s) length = ::strlen(s); -#ifdef MEM_DEBUG - data = new(__FILE__,__LINE__) char[length+1]; -#else data = new char[length+1]; -#endif if (data) { if (s) ::strcpy(data, s); @@ -65,11 +56,7 @@ TextRep::TextRep(const char* s, int len) { if (length < 0) length = 0; -#ifdef MEM_DEBUG - data = new(__FILE__,__LINE__) char[length+1]; -#else data = new char[length+1]; -#endif if (data) { ::CopyMemory(data, s, length); @@ -83,11 +70,7 @@ TextRep::TextRep(char c, int len) { if (length < 0) length = 0; -#ifdef MEM_DEBUG - data = new(__FILE__,__LINE__) char[length+1]; -#else data = new char[length+1]; -#endif if (data) { ::FillMemory(data, length, c); @@ -101,11 +84,7 @@ TextRep::TextRep(const TextRep* rep) { length = rep->length; -#ifdef MEM_DEBUG - data = new(__FILE__,__LINE__) char[length+1]; -#else data = new char[length+1]; -#endif hash = rep->hash; sensitive = rep->sensitive; @@ -177,11 +156,7 @@ Text::Text(char c) { char buf[2]; buf[0] = c; buf[1] = '\0'; -#ifdef MEM_DEBUG - rep = new(__FILE__,__LINE__) TextRep(buf); -#else rep = new TextRep(buf); -#endif if (!rep) { rep = &TextRep::nullrep; @@ -193,11 +168,7 @@ Text::Text(char c) Text::Text(const char* s) { -#ifdef MEM_DEBUG - rep = new(__FILE__,__LINE__) TextRep(s); -#else rep = new TextRep(s); -#endif if (!rep) { rep = &TextRep::nullrep; @@ -209,11 +180,7 @@ Text::Text(const char* s) Text::Text(const char* s, int len) { -#ifdef MEM_DEBUG - rep = new(__FILE__,__LINE__) TextRep(s, len); -#else rep = new TextRep(s, len); -#endif if (!rep) { rep = &TextRep::nullrep; @@ -225,11 +192,7 @@ Text::Text(const char* s, int len) Text::Text(char c, int len) { -#ifdef MEM_DEBUG - rep = new(__FILE__,__LINE__) TextRep(c, len); -#else rep = new TextRep(c, len); -#endif if (!rep) { rep = &TextRep::nullrep; @@ -258,11 +221,7 @@ Text& Text::operator=(const char* s) { if (rep->deref() == 0) delete rep; -#ifdef MEM_DEBUG - rep = new(__FILE__,__LINE__) TextRep(s); -#else rep = new TextRep(s); -#endif if (!rep) rep = &TextRep::nullrep; @@ -283,11 +242,7 @@ Text::operator=(const Text& s) Text Text::operator+(char c) { -#ifdef MEM_DEBUG - char* buf = new(__FILE__,__LINE__) char[rep->length + 2]; -#else char* buf = new char[rep->length + 2]; -#endif if (buf) { ::strcpy(buf, sym); @@ -306,11 +261,7 @@ Text::operator+(char c) Text Text::operator+(const char* s) { -#ifdef MEM_DEBUG - char* buf = new(__FILE__,__LINE__) char[::strlen(s) + rep->length + 1]; -#else char* buf = new char[::strlen(s) + rep->length + 1]; -#endif if (buf) { ::strcpy(buf, sym); @@ -328,11 +279,7 @@ Text::operator+(const char* s) Text Text::operator+(const Text& s) { -#ifdef MEM_DEBUG - char* buf = new(__FILE__,__LINE__) char[s.rep->length + rep->length + 1]; -#else char* buf = new char[s.rep->length + rep->length + 1]; -#endif if (buf) { ::strcpy(buf, sym); @@ -362,11 +309,7 @@ Text::setSensitive(bool s) Text& Text::append(char c) { -#ifdef MEM_DEBUG - char* buf = new(__FILE__,__LINE__) char[rep->length + 2]; -#else char* buf = new char[rep->length + 2]; -#endif if (buf) { ::strcpy(buf, sym); @@ -374,11 +317,7 @@ Text::append(char c) buf[rep->length+1] = '\0'; if (rep->deref() == 0) delete rep; -#ifdef MEM_DEBUG - rep = new(__FILE__,__LINE__) TextRep(buf); -#else rep = new TextRep(buf); -#endif if (!rep) rep = &TextRep::nullrep; @@ -393,22 +332,14 @@ Text::append(char c) Text& Text::append(const char* s) { -#ifdef MEM_DEBUG - char* buf = new(__FILE__,__LINE__) char[::strlen(s) + rep->length + 1]; -#else char* buf = new char[::strlen(s) + rep->length + 1]; -#endif if (buf) { ::strcpy(buf, sym); ::strcat(buf, s); if (rep->deref() == 0) delete rep; -#ifdef MEM_DEBUG - rep = new(__FILE__,__LINE__) TextRep(buf); -#else rep = new TextRep(buf); -#endif if (!rep) rep = &TextRep::nullrep; @@ -423,11 +354,7 @@ Text::append(const char* s) Text& Text::append(const Text& s) { -#ifdef MEM_DEBUG - char* buf = new(__FILE__,__LINE__) char[s.rep->length + rep->length + 1]; -#else char* buf = new char[s.rep->length + rep->length + 1]; -#endif if (buf) { int lenA = rep->length; @@ -439,11 +366,7 @@ Text::append(const Text& s) if (rep->deref() == 0) delete rep; -#ifdef MEM_DEBUG - rep = new(__FILE__,__LINE__) TextRep(buf, lenA + lenB); -#else rep = new TextRep(buf); -#endif if (!rep) rep = &TextRep::nullrep; @@ -461,11 +384,7 @@ Text::clone() if (rep->ref > 1) { rep->deref(); -#ifdef MEM_DEBUG - TextRep* t = new(__FILE__,__LINE__) TextRep(rep); -#else TextRep* t = new TextRep(rep); -#endif rep = t; @@ -522,11 +441,7 @@ Text::operator()(int start, int len) const if (start + len > rep->length) len = rep->length - start; -#ifdef MEM_DEBUG - char* buf = new(__FILE__,__LINE__) char[len+1]; -#else char* buf = new char[len+1]; -#endif if (buf) { ::strncpy(buf, sym+start, len); @@ -689,11 +604,7 @@ Text::substring(int start, int length) const char* s = sym + start; -#ifdef MEM_DEBUG - result.rep = new(__FILE__,__LINE__) TextRep(s, length); -#else result.rep = new TextRep(s, length); -#endif if (!result.rep) result.rep = &TextRep::nullrep; -- cgit v1.1