| OLD | NEW |
| 1 | 1 |
| 2 //---------------------------------------------------------------------------- | 2 //---------------------------------------------------------------------------- |
| 3 // Anti-Grain Geometry - Version 2.3 | 3 // Anti-Grain Geometry - Version 2.3 |
| 4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) | 4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) |
| 5 // | 5 // |
| 6 // Permission to copy, use, modify, sell and distribute this software | 6 // Permission to copy, use, modify, sell and distribute this software |
| 7 // is granted provided this copyright notice appears in all copies. | 7 // is granted provided this copyright notice appears in all copies. |
| 8 // This software is provided "as is" without express or implied | 8 // This software is provided "as is" without express or implied |
| 9 // warranty, and with no claim as to its suitability for any purpose. | 9 // warranty, and with no claim as to its suitability for any purpose. |
| 10 // | 10 // |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 void pod_array<T>::capacity(unsigned cap, unsigned extra_tail) | 104 void pod_array<T>::capacity(unsigned cap, unsigned extra_tail) |
| 105 { | 105 { |
| 106 m_size = 0; | 106 m_size = 0; |
| 107 unsigned full_cap = cap + extra_tail; | 107 unsigned full_cap = cap + extra_tail; |
| 108 if(full_cap < cap) { | 108 if(full_cap < cap) { |
| 109 FX_Free(m_array); | 109 FX_Free(m_array); |
| 110 m_array = 0; | 110 m_array = 0; |
| 111 m_capacity = 0; | 111 m_capacity = 0; |
| 112 } else if(full_cap > m_capacity) { | 112 } else if(full_cap > m_capacity) { |
| 113 FX_Free(m_array); | 113 FX_Free(m_array); |
| 114 m_array = 0; | |
| 115 m_capacity = 0; | |
| 116 m_array = FX_Alloc(T, full_cap); | 114 m_array = FX_Alloc(T, full_cap); |
| 117 if (m_array) { | 115 m_capacity = full_cap; |
| 118 m_capacity = full_cap; | |
| 119 } | |
| 120 } | 116 } |
| 121 } | 117 } |
| 122 template<class T> | 118 template<class T> |
| 123 void pod_array<T>::allocate(unsigned size, unsigned extra_tail) | 119 void pod_array<T>::allocate(unsigned size, unsigned extra_tail) |
| 124 { | 120 { |
| 125 capacity(size, extra_tail); | 121 capacity(size, extra_tail); |
| 126 m_size = size; | 122 m_size = size; |
| 127 } | 123 } |
| 128 template<class T> | 124 template<class T> |
| 129 void pod_array<T>::resize(unsigned new_size) | 125 void pod_array<T>::resize(unsigned new_size) |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 quick_sort_threshold = 9 | 497 quick_sort_threshold = 9 |
| 502 }; | 498 }; |
| 503 template<class T> inline void swap_elements(T& a, T& b) | 499 template<class T> inline void swap_elements(T& a, T& b) |
| 504 { | 500 { |
| 505 T temp = a; | 501 T temp = a; |
| 506 a = b; | 502 a = b; |
| 507 b = temp; | 503 b = temp; |
| 508 } | 504 } |
| 509 } | 505 } |
| 510 #endif | 506 #endif |
| OLD | NEW |