summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-03-09 09:38:00 +0000
committerrubidium <rubidium@openttd.org>2009-03-09 09:38:00 +0000
commit75a32223c60c81e5f62471c303e1d8cd1a4b88f3 (patch)
treea63c3729163ccf5b1c637ba9d01103839d3fe94a
parent236ca3ae17e02871844852a234c2f7b6504a3a01 (diff)
downloadopenttd-75a32223c60c81e5f62471c303e1d8cd1a4b88f3.tar.xz
(svn r15649) -Fix (r15556): don't unnecessarily reallocate
-rw-r--r--src/core/alloc_type.hpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/alloc_type.hpp b/src/core/alloc_type.hpp
index b95fc79ee..4451f0479 100644
--- a/src/core/alloc_type.hpp
+++ b/src/core/alloc_type.hpp
@@ -102,6 +102,7 @@ public:
if (this->count < count) {
free(this->buffer);
this->buffer = MallocT<T>(count);
+ this->count = count;
}
return this->buffer;
}
@@ -118,6 +119,7 @@ public:
if (this->count < count) {
free(this->buffer);
this->buffer = CallocT<T>(count);
+ this->count = count;
} else {
memset(this->buffer, 0, sizeof(T) * count);
}