mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
5886090182
myisammrg/ | Makefile.am | mymrgdef.h | support for keys myrg_open.c | & myrg_queue.c | bugfixes myrg_rfirst.c | myrg_rkey.c | myrg_rlast.c | myrg_rnext.c | myrg_rprev.c | myrg_rrnd.c | include/myisammrg.h | rkey/rnext/etc prototyped sql/ | ha_myisammrg.cc | support for keys ha_myisammrg.h | myisam/ | mi_rkey.c | buf==NULL extension, _mi_rkey() mi_rnext.c | mi_rprev.c | include/queues.h | reinit_queue() - same as init_queue, but w/o malloc mysys/queues.c | PART II: Miscellaneous myisam/common_words | deleted (looks like I checked it in by mistake) some files (like acconfig.h, Makefile.am, COPYING.LIB, etc) | Change mode to -rw-r--r-- (by `chmod a-x ')
60 lines
2 KiB
C
60 lines
2 KiB
C
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Library General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Library General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
License along with this library; if not, write to the Free
|
|
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
|
MA 02111-1307, USA */
|
|
|
|
/*
|
|
Code for generell handling of priority Queues.
|
|
Implemention of queues from "Algoritms in C" by Robert Sedgewick.
|
|
Copyright Monty Program KB.
|
|
By monty.
|
|
*/
|
|
|
|
#ifndef _queues_h
|
|
#define _queues_h
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct st_queue {
|
|
byte **root;
|
|
void *first_cmp_arg;
|
|
uint elements;
|
|
uint max_elements;
|
|
uint offset_to_key; /* compare is done on element+offset */
|
|
int max_at_top; /* Set if queue_top gives max */
|
|
int (*compare)(void *, byte *,byte *);
|
|
} QUEUE;
|
|
|
|
#define queue_top(queue) ((queue)->root[1])
|
|
#define queue_element(queue,index) ((queue)->root[index+1])
|
|
#define queue_end(queue) ((queue)->root[(queue)->elements])
|
|
#define queue_replaced(queue) _downheap(queue,1)
|
|
|
|
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
|
|
pbool max_at_top, int (*compare)(void *,byte *, byte *),
|
|
void *first_cmp_arg);
|
|
int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
|
|
pbool max_at_top, int (*compare)(void *,byte *, byte *),
|
|
void *first_cmp_arg);
|
|
void delete_queue(QUEUE *queue);
|
|
void queue_insert(QUEUE *queue,byte *element);
|
|
byte *queue_remove(QUEUE *queue,uint idx);
|
|
void _downheap(QUEUE *queue,uint idx);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|