2015-04-05 20:27:02 +02:00
|
|
|
#ifndef __STRHEAP_H
|
|
|
|
#define __STRHEAP_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2015-04-11 19:00:51 +02:00
|
|
|
#include "strlist.h"
|
2015-04-05 20:27:02 +02:00
|
|
|
#include "avltree.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct avltree * cw_strheap_t;
|
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
|
2015-04-05 20:27:02 +02:00
|
|
|
extern cw_strheap_t cw_strheap_create();
|
|
|
|
extern int cw_strheap_register_strings(cw_strheap_t h, struct cw_str *s);
|
|
|
|
|
|
|
|
static inline const char * cw_strheap_get(cw_strheap_t h, int id) {
|
2015-04-07 07:42:36 +02:00
|
|
|
struct cw_str s;
|
2015-04-05 20:27:02 +02:00
|
|
|
s.id=id;
|
2015-04-07 07:42:36 +02:00
|
|
|
struct cw_str *r = avltree_get(h,&s);
|
|
|
|
if (r)
|
|
|
|
return r->str;
|
|
|
|
return NULL;
|
2015-04-05 20:27:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|