summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-06-10 21:59:22 +0000
committersmatz <smatz@openttd.org>2008-06-10 21:59:22 +0000
commitbd5067b5a0705cd6bef891d2bbfed8d78616d5a6 (patch)
tree1e9c70ae3dc2bbcd2c970580934f71f53844a48a /src/core
parentf4153bcbde9808a31812ef30fb7e612c778d0da7 (diff)
downloadopenttd-bd5067b5a0705cd6bef891d2bbfed8d78616d5a6.tar.xz
(svn r13456) -Codechange: use AllocaM() macro instead of alloca() at most places
Diffstat (limited to 'src/core')
-rw-r--r--src/core/alloc_func.hpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/alloc_func.hpp b/src/core/alloc_func.hpp
index d5e90832e..ec30ffb6e 100644
--- a/src/core/alloc_func.hpp
+++ b/src/core/alloc_func.hpp
@@ -90,4 +90,7 @@ template <typename T> FORCEINLINE T* ReallocT(T *t_ptr, size_t num_elements)
return t_ptr;
}
+/** alloca() has to be called in the parent function, so define AllocaM() as a macro */
+#define AllocaM(T, num_elements) ((T*)alloca((num_elements) * sizeof(T)))
+
#endif /* ALLOC_FUNC_HPP */