author | Tero Marttila <terom@fixme.fi> |
Tue, 22 Jul 2008 21:51:14 +0300 | |
changeset 11180 | 982e9f814f97 |
parent 11050 | 091271fcfbb9 |
permissions | -rw-r--r-- |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
diff
changeset
|
2 |
|
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
3 |
/** @file alloc_type.hpp Helper types related to the allocation of memory */ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
diff
changeset
|
4 |
|
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
5 |
#ifndef ALLOC_TYPE_HPP |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
6 |
#define ALLOC_TYPE_HPP |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
diff
changeset
|
7 |
|
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
8 |
#include "alloc_func.hpp" |
8626
440dfcd14c4a
(svn r11691) -Codechange: move+rename helpers.hpp and only include it when it is really needed.
rubidium
parents:
8608
diff
changeset
|
9 |
|
8872
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
10 |
/** |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
11 |
* A small 'wrapper' for allocations that can be done on most OSes on the |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
12 |
* stack, but are just too large to fit in the stack on devices with a small |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
13 |
* stack such as the NDS. |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
14 |
* So when it is possible a stack allocation is made, otherwise a heap |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
15 |
* allocation is made and this is freed once the struct goes out of scope. |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
16 |
* @param T the type to make the allocation for |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
17 |
* @param length the amount of items to allocate |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
18 |
*/ |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
19 |
template <typename T, size_t length> |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
20 |
struct SmallStackSafeStackAlloc { |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
21 |
#if !defined(__NDS__) |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
22 |
/** Storing the data on the stack */ |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
23 |
T data[length]; |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
24 |
#else |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
25 |
/** Storing it on the heap */ |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
26 |
T *data; |
9294
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
27 |
/** The length (in elements) of data in this allocator. */ |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
28 |
size_t len; |
8872
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
29 |
|
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
30 |
/** Allocating the memory */ |
9294
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
31 |
SmallStackSafeStackAlloc() : data(MallocT<T>(length)), len(length) {} |
11050
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
32 |
|
8872
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
33 |
/** And freeing when it goes out of scope */ |
11050
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
34 |
~SmallStackSafeStackAlloc() |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
35 |
{ |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
36 |
free(data); |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
37 |
} |
8872
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
38 |
#endif |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
39 |
|
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
40 |
/** |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
41 |
* Gets a pointer to the data stored in this wrapper. |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
42 |
* @return the pointer. |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
43 |
*/ |
11050
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
44 |
FORCEINLINE operator T* () |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
45 |
{ |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
46 |
return data; |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
47 |
} |
9294
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
48 |
|
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
49 |
/** |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
50 |
* Gets a pointer to the data stored in this wrapper. |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
51 |
* @return the pointer. |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
52 |
*/ |
11050
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
53 |
FORCEINLINE T* operator -> () |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
54 |
{ |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
55 |
return data; |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
56 |
} |
9294
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
57 |
|
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
58 |
/** |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
59 |
* Gets a pointer to the last data element stored in this wrapper. |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
60 |
* @note needed because endof does not work properly for pointers. |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
61 |
* @return the 'endof' pointer. |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
62 |
*/ |
11050
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
63 |
FORCEINLINE T* EndOf() |
091271fcfbb9
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
skidd13
parents:
11049
diff
changeset
|
64 |
{ |
9294
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
65 |
#if !defined(__NDS__) |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
66 |
return endof(data); |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
67 |
#else |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
68 |
return &data[len]; |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
69 |
#endif |
5cd9e0da420f
(svn r12536) -Codechange: some stack allocations were too large for NDS, so use the SmallStackSafeStackAlloc wrapper. Allocate on the stack by default and on the heap for NDS (or other devices that have a very small stack).
rubidium
parents:
9033
diff
changeset
|
70 |
} |
8872
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
71 |
}; |
dd23eb1922b6
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8626
diff
changeset
|
72 |
|
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
73 |
/** |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
74 |
* Base class that provides memory initialization on dynamically created objects. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
75 |
* All allocated memory will be zeroed. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
76 |
*/ |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
77 |
class ZeroedMemoryAllocator |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
78 |
{ |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
79 |
public: |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
80 |
ZeroedMemoryAllocator() {} |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
81 |
virtual ~ZeroedMemoryAllocator() {} |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
82 |
|
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
83 |
/** |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
84 |
* Memory allocator for a single class instance. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
85 |
* @param size the amount of bytes to allocate. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
86 |
* @return the given amounts of bytes zeroed. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
87 |
*/ |
11049
f8bbc9635251
(svn r13606) -Codechange: use "static FORCEINLINE" where possible as default for core functions (big functions use just inline instead)
skidd13
parents:
10429
diff
changeset
|
88 |
FORCEINLINE void *operator new(size_t size) { return CallocT<byte>(size); } |
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
89 |
|
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
90 |
/** |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
91 |
* Memory allocator for an array of class instances. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
92 |
* @param size the amount of bytes to allocate. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
93 |
* @return the given amounts of bytes zeroed. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
94 |
*/ |
11049
f8bbc9635251
(svn r13606) -Codechange: use "static FORCEINLINE" where possible as default for core functions (big functions use just inline instead)
skidd13
parents:
10429
diff
changeset
|
95 |
FORCEINLINE void *operator new[](size_t size) { return CallocT<byte>(size); } |
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
96 |
|
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
97 |
/** |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
98 |
* Memory release for a single class instance. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
99 |
* @param ptr the memory to free. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
100 |
* @param size the amount of allocated memory (unused). |
10217
691a6b2140c6
(svn r12749) -Codechange: store the viewport information in the windows that have a viewport instead of one global array with a viewport for each window, even when they do not use the viewport.
rubidium
parents:
10164
diff
changeset
|
101 |
* |
691a6b2140c6
(svn r12749) -Codechange: store the viewport information in the windows that have a viewport instead of one global array with a viewport for each window, even when they do not use the viewport.
rubidium
parents:
10164
diff
changeset
|
102 |
* @warning The value of the \a size parameter can only be trusted for |
691a6b2140c6
(svn r12749) -Codechange: store the viewport information in the windows that have a viewport instead of one global array with a viewport for each window, even when they do not use the viewport.
rubidium
parents:
10164
diff
changeset
|
103 |
* classes that have their own (virtual) destructor method. |
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
104 |
*/ |
11049
f8bbc9635251
(svn r13606) -Codechange: use "static FORCEINLINE" where possible as default for core functions (big functions use just inline instead)
skidd13
parents:
10429
diff
changeset
|
105 |
FORCEINLINE void operator delete(void *ptr, size_t size) { free(ptr); } |
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
106 |
|
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
107 |
/** |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
108 |
* Memory release for an array of class instances. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
109 |
* @param ptr the memory to free. |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
110 |
* @param size the amount of allocated memory (unused). |
10217
691a6b2140c6
(svn r12749) -Codechange: store the viewport information in the windows that have a viewport instead of one global array with a viewport for each window, even when they do not use the viewport.
rubidium
parents:
10164
diff
changeset
|
111 |
* |
691a6b2140c6
(svn r12749) -Codechange: store the viewport information in the windows that have a viewport instead of one global array with a viewport for each window, even when they do not use the viewport.
rubidium
parents:
10164
diff
changeset
|
112 |
* @warning The value of the \a size parameter can only be trusted for |
691a6b2140c6
(svn r12749) -Codechange: store the viewport information in the windows that have a viewport instead of one global array with a viewport for each window, even when they do not use the viewport.
rubidium
parents:
10164
diff
changeset
|
113 |
* classes that have their own (virtual) destructor method. |
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
114 |
*/ |
11049
f8bbc9635251
(svn r13606) -Codechange: use "static FORCEINLINE" where possible as default for core functions (big functions use just inline instead)
skidd13
parents:
10429
diff
changeset
|
115 |
FORCEINLINE void operator delete[](void *ptr, size_t size) { free(ptr); } |
10164
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
116 |
}; |
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
117 |
|
3ff9e65f3d49
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
9294
diff
changeset
|
118 |
#endif /* ALLOC_TYPE_HPP */ |