aboutsummaryrefslogtreecommitdiff
path: root/src/priority-queue.h
blob: fe009758ea230a3dafe5f9cfc1cdaaf182b5ff6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef INCLUDED_PRIORITY_QUEUE_H
#define INCLUDED_PRIORITY_QUEUE_H

#include <stdlib.h>

typedef struct priority_queue_item {
  int   priority;               // 0 is max priority
  void *data;
} *PRIORITY_QUEUE_ITEM;

typedef struct priority_queue {
  struct priority_queue_item *items;
  size_t                      count;
  size_t                      capacity;
} *PRIORITY_QUEUE;

extern void  priority_queue_push (PRIORITY_QUEUE, struct priority_queue_item);
extern void *priority_queue_pop  (PRIORITY_QUEUE);

#endif