| 147 | |
| 148 | template<typename Element_type, typename Key_type> |
| 149 | int Bounded_queue<Element_type, Key_type>::init(ha_rows max_elements, |
| 150 | bool max_at_top, |
| 151 | compare_function compare, |
| 152 | size_t compare_length, |
| 153 | keymaker_function keymaker, |
| 154 | Sort_param *sort_param, |
| 155 | Key_type **sort_keys) |
| 156 | { |
| 157 | DBUG_ASSERT(sort_keys != NULL); |
| 158 | |
| 159 | m_sort_keys= sort_keys; |
| 160 | m_compare_length= compare_length; |
| 161 | m_keymaker= keymaker; |
| 162 | m_sort_param= sort_param; |
| 163 | // init_queue() takes an uint, and also does (max_elements + 1) |
| 164 | if (max_elements >= (UINT_MAX - 1)) |
| 165 | return 1; |
| 166 | if (compare == NULL) |
| 167 | compare= |
| 168 | reinterpret_cast<compare_function>(get_ptr_compare(compare_length)); |
| 169 | |
| 170 | DBUG_EXECUTE_IF("bounded_queue_init_fail", |
| 171 | DBUG_SET("+d,simulate_out_of_memory");); |
| 172 | |
| 173 | // We allocate space for one extra element, for replace when queue is full. |
| 174 | return init_queue(&m_queue, (uint) max_elements + 1, |
| 175 | 0, max_at_top, |
| 176 | reinterpret_cast<queue_compare>(compare), |
| 177 | &m_compare_length); |
| 178 | } |
| 179 | |
| 180 | |
| 181 | template<typename Element_type, typename Key_type> |
nothing calls this directly
no test coverage detected