| 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; |
| 114 m_array = FX_Alloc(T, full_cap); | 116 m_array = FX_Alloc(T, full_cap); |
| 115 m_capacity = full_cap; | 117 if (m_array) { |
| 118 m_capacity = full_cap; |
| 119 } |
| 116 } | 120 } |
| 117 } | 121 } |
| 118 template<class T> | 122 template<class T> |
| 119 void pod_array<T>::allocate(unsigned size, unsigned extra_tail) | 123 void pod_array<T>::allocate(unsigned size, unsigned extra_tail) |
| 120 { | 124 { |
| 121 capacity(size, extra_tail); | 125 capacity(size, extra_tail); |
| 122 m_size = size; | 126 m_size = size; |
| 123 } | 127 } |
| 124 template<class T> | 128 template<class T> |
| 125 void pod_array<T>::resize(unsigned new_size) | 129 void pod_array<T>::resize(unsigned new_size) |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 quick_sort_threshold = 9 | 501 quick_sort_threshold = 9 |
| 498 }; | 502 }; |
| 499 template<class T> inline void swap_elements(T& a, T& b) | 503 template<class T> inline void swap_elements(T& a, T& b) |
| 500 { | 504 { |
| 501 T temp = a; | 505 T temp = a; |
| 502 a = b; | 506 a = b; |
| 503 b = temp; | 507 b = temp; |
| 504 } | 508 } |
| 505 } | 509 } |
| 506 #endif | 510 #endif |
| OLD | NEW |