From ebe5c7e428b57dca758b1b3a1d8b7d4b423b19a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 22 Jan 2019 11:42:58 +0100 Subject: Start using trie's instead of hash-maps. --- vcal.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'vcal.h') diff --git a/vcal.h b/vcal.h index 285d2d0b..0876e0a9 100644 --- a/vcal.h +++ b/vcal.h @@ -24,21 +24,20 @@ typedef struct { } content_line; #define TYPE content_line -#include "hash.h" +// #include "hash.h" +#include "trie.h" #undef TYPE -struct s_vevent { +typedef struct s_vevent { /* strbuf dtstart; strbuf dtend; strbuf summary; strbuf description; */ - TABLE(content_line) clines; -}; - -struct s_vevent; -typedef struct s_vevent vevent; + // TABLE(content_line) clines; + TRIE(content_line) clines; +} vevent; int CONSTRUCTOR_DECL(vevent, int init_size); @@ -69,12 +68,15 @@ int free_vevent(vevent* ev); typedef struct { size_t n_events; size_t alloc; - vevent* events; + vevent** events; } vcalendar; int CONSTRUCTOR_DECL(vcalendar); int free_vcalendar (vcalendar* cal); +/* + * Appends ev to cal. Doesn't copy ev + */ int push_event(vcalendar* cal, vevent* ev); #endif /* VCAL_H */ -- cgit v1.2.3