summaryrefslogtreecommitdiff
path: root/mysys/queues.c
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-10-15 16:55:24 +0300
committerunknown <monty@mashka.mysql.fi>2003-10-15 16:55:24 +0300
commit48446c0f73a99f7cb6a1f00700e6ea066ed28984 (patch)
tree7e45fed9e18c3d6d2d2ba0dff06ae4d79cf7b2d0 /mysys/queues.c
parent60fb31ddec27323101ad491bf324da5df2b04ab6 (diff)
downloadmariadb-git-48446c0f73a99f7cb6a1f00700e6ea066ed28984.tar.gz
Updated comments
mysys/queues.c: Comments for new functions (no code change) mysys/thr_alarm.c: Updated comment
Diffstat (limited to 'mysys/queues.c')
-rw-r--r--mysys/queues.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/mysys/queues.c b/mysys/queues.c
index ae69684f9e4..93d4c303f22 100644
--- a/mysys/queues.c
+++ b/mysys/queues.c
@@ -61,6 +61,24 @@ int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
DBUG_RETURN(0);
}
+
+/*
+ Resize queue
+
+ SYNOPSIS
+ resize_queue()
+ queue Queue
+ max_elements New max size for queue
+
+ NOTES
+ If you resize queue to be less than the elements you have in it,
+ the extra elements will be deleted
+
+ RETURN
+ 0 ok
+ 1 Error. In this case the queue is unchanged
+*/
+
int resize_queue(QUEUE *queue, uint max_elements)
{
byte **new_root;
@@ -68,14 +86,16 @@ int resize_queue(QUEUE *queue, uint max_elements)
if (queue->max_elements == max_elements)
DBUG_RETURN(0);
if ((new_root= (byte **) my_realloc((void *)queue->root,
- (max_elements+1)*sizeof(void*), MYF(MY_WME))) == 0)
+ (max_elements+1)*sizeof(void*),
+ MYF(MY_WME))) == 0)
DBUG_RETURN(1);
set_if_smaller(queue->elements, max_elements);
- queue->max_elements=max_elements;
- queue->root=new_root;
+ queue->max_elements= max_elements;
+ queue->root= new_root;
DBUG_RETURN(0);
}
+
void delete_queue(QUEUE *queue)
{
DBUG_ENTER("delete_queue");