summaryrefslogtreecommitdiff
path: root/src/helpers.hpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-12-25 09:48:53 +0000
committerrubidium <rubidium@openttd.org>2007-12-25 09:48:53 +0000
commitbf98e25e43c3f6efe207c3dde1732d44c34ac285 (patch)
tree7d96120bc1feabf7069c9cd673a8da769e8f90fd /src/helpers.hpp
parente2f79f0eb5d602b77bf72a2b4adca50f0a2056db (diff)
downloadopenttd-bf98e25e43c3f6efe207c3dde1732d44c34ac285.tar.xz
(svn r11691) -Codechange: move+rename helpers.hpp and only include it when it is really needed.
Diffstat (limited to 'src/helpers.hpp')
-rw-r--r--src/helpers.hpp42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/helpers.hpp b/src/helpers.hpp
deleted file mode 100644
index aaa38acb5..000000000
--- a/src/helpers.hpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $Id$ */
-
-/** @file helpers.hpp */
-
-#ifndef HELPERS_HPP
-#define HELPERS_HPP
-
-/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
-* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
-template <typename T> FORCEINLINE T* MallocT(size_t num_elements)
-{
- T *t_ptr = (T*)malloc(num_elements * sizeof(T));
- if (t_ptr == NULL && num_elements != 0) error("Out of memory. Cannot allocate %i bytes", num_elements * sizeof(T));
- return t_ptr;
-}
-/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
-* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
-template <typename T> FORCEINLINE T* CallocT(size_t num_elements)
-{
- T *t_ptr = (T*)calloc(num_elements, sizeof(T));
- if (t_ptr == NULL && num_elements != 0) error("Out of memory. Cannot allocate %i bytes", num_elements * sizeof(T));
- return t_ptr;
-}
-/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
-* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
-template <typename T> FORCEINLINE T* ReallocT(T* t_ptr, size_t num_elements)
-{
- t_ptr = (T*)realloc(t_ptr, num_elements * sizeof(T));
- if (t_ptr == NULL && num_elements != 0) error("Out of memory. Cannot reallocate %i bytes", num_elements * sizeof(T));
- return t_ptr;
-}
-
-
-/** type safe swap operation */
-template<typename T> void Swap(T& a, T& b)
-{
- T t = a;
- a = b;
- b = t;
-}
-
-#endif /* HELPERS_HPP */