mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysql.com:/home/svoj/devel/mysql/BUG21617/mysql-5.0-engines
into mysql.com:/home/svoj/devel/mysql/BUG21617/mysql-5.1-engines mysql-test/r/merge.result: Auto merged mysql-test/t/merge.test: Auto merged mysys/queues.c: Auto merged storage/myisammrg/myrg_open.c: Auto merged storage/myisammrg/myrg_queue.c: Auto merged
This commit is contained in:
@ -208,28 +208,22 @@ void delete_queue(QUEUE *queue)
|
||||
|
||||
void queue_insert(register QUEUE *queue, byte *element)
|
||||
{
|
||||
reg2 uint idx,next;
|
||||
reg2 uint idx, next;
|
||||
int cmp;
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
if (queue->elements < queue->max_elements)
|
||||
#endif
|
||||
DBUG_ASSERT(queue->elements < queue->max_elements);
|
||||
queue->root[0]= element;
|
||||
idx= ++queue->elements;
|
||||
/* max_at_top swaps the comparison if we want to order by desc */
|
||||
while ((cmp= queue->compare(queue->first_cmp_arg,
|
||||
element + queue->offset_to_key,
|
||||
queue->root[(next= idx >> 1)] +
|
||||
queue->offset_to_key)) &&
|
||||
(cmp ^ queue->max_at_top) < 0)
|
||||
{
|
||||
queue->root[0]=element;
|
||||
idx= ++queue->elements;
|
||||
|
||||
/* max_at_top swaps the comparison if we want to order by desc */
|
||||
while ((cmp=queue->compare(queue->first_cmp_arg,
|
||||
element+queue->offset_to_key,
|
||||
queue->root[(next=idx >> 1)] +
|
||||
queue->offset_to_key)) &&
|
||||
(cmp ^ queue->max_at_top) < 0)
|
||||
{
|
||||
queue->root[idx]=queue->root[next];
|
||||
idx=next;
|
||||
}
|
||||
queue->root[idx]=element;
|
||||
queue->root[idx]= queue->root[next];
|
||||
idx= next;
|
||||
}
|
||||
queue->root[idx]= element;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -262,16 +256,12 @@ int queue_insert_safe(register QUEUE *queue, byte *element)
|
||||
|
||||
byte *queue_remove(register QUEUE *queue, uint idx)
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
if (idx >= queue->max_elements)
|
||||
return 0;
|
||||
#endif
|
||||
{
|
||||
byte *element=queue->root[++idx]; /* Intern index starts from 1 */
|
||||
queue->root[idx]=queue->root[queue->elements--];
|
||||
_downheap(queue,idx);
|
||||
return element;
|
||||
}
|
||||
byte *element;
|
||||
DBUG_ASSERT(idx < queue->max_elements);
|
||||
element= queue->root[++idx]; /* Intern index starts from 1 */
|
||||
queue->root[idx]= queue->root[queue->elements--];
|
||||
_downheap(queue, idx);
|
||||
return element;
|
||||
}
|
||||
|
||||
/* Fix when element on top has been replaced */
|
||||
|
Reference in New Issue
Block a user