aboutsummaryrefslogtreecommitdiff
path: root/gob/util.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2006-01-29 02:27:10 +0000
committerEugene Sandulenko2006-01-29 02:27:10 +0000
commit4780ab9223293243fdeadbda490eeea25aba2072 (patch)
tree9cbf33b790e67b8ca89cd59195f183075e7767cd /gob/util.cpp
parentbdac3715992d457e30eb3874ac47a60e4632acb7 (diff)
downloadscummvm-rg350-4780ab9223293243fdeadbda490eeea25aba2072.tar.gz
scummvm-rg350-4780ab9223293243fdeadbda490eeea25aba2072.tar.bz2
scummvm-rg350-4780ab9223293243fdeadbda490eeea25aba2072.zip
Patch #1417631: "gobliiins cleanup". Thanks, wjp.
svn-id: r20283
Diffstat (limited to 'gob/util.cpp')
-rw-r--r--gob/util.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/gob/util.cpp b/gob/util.cpp
index 601ffe6c47..139cd24688 100644
--- a/gob/util.cpp
+++ b/gob/util.cpp
@@ -271,7 +271,7 @@ int16 joy_calibrate() {
}
Video::FontDesc *Util::loadFont(const char *path) {
- Video::FontDesc *fontDesc = (Video::FontDesc *) malloc(sizeof(Video::FontDesc));
+ Video::FontDesc *fontDesc = new Video::FontDesc;
char *data;
if (fontDesc == 0)
@@ -279,7 +279,7 @@ Video::FontDesc *Util::loadFont(const char *path) {
data = _vm->_dataio->getData(path);
if (data == 0) {
- free(fontDesc);
+ delete fontDesc;
return 0;
}
@@ -303,8 +303,8 @@ Video::FontDesc *Util::loadFont(const char *path) {
}
void Util::freeFont(Video::FontDesc * fontDesc) {
- free(fontDesc->dataPtr - 4);
- free(fontDesc);
+ delete[] (fontDesc->dataPtr - 4);
+ delete fontDesc;
}
void Util::clearPalette(void) {
@@ -390,7 +390,7 @@ int16 Util::strstr(const char *str1, char *str2) {
void Util::listInsertFront(List * list, void *data) {
ListNode *node;
- node = (ListNode *) malloc(sizeof(ListNode));
+ node = new ListNode;
if (list->pHead != 0) {
node->pData = data;
node->pNext = list->pHead;
@@ -415,8 +415,7 @@ void Util::listInsertBack(List * list, void *data) {
warning("listInsertBack: Broken list!");
}
- node =
- (ListNode *) malloc(sizeof(ListNode));
+ node = new ListNode;
node->pData = data;
node->pPrev = list->pTail;
node->pNext = 0;
@@ -429,12 +428,12 @@ void Util::listInsertBack(List * list, void *data) {
void Util::listDropFront(List * list) {
if (list->pHead->pNext == 0) {
- free((list->pHead));
+ delete list->pHead;
list->pHead = 0;
list->pTail = 0;
} else {
list->pHead = list->pHead->pNext;
- free((list->pHead->pPrev));
+ delete list->pHead->pPrev;
list->pHead->pPrev = 0;
}
}
@@ -444,7 +443,7 @@ void Util::deleteList(List * list) {
listDropFront(list);
}
- free(list);
+ delete list;
}
const char Util::trStr1[] =