aboutsummaryrefslogtreecommitdiff
path: root/vcal.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-03 23:35:27 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-03 23:35:27 +0100
commit82c63a1f2422c3f4b1599bcb889e3ed1fc4f6ed0 (patch)
treec433dbc1621492794c6d9993f4939aa68c20940b /vcal.c
parentLoads of memmory fixes, among other. (diff)
downloadcalp-82c63a1f2422c3f4b1599bcb889e3ed1fc4f6ed0.tar.gz
calp-82c63a1f2422c3f4b1599bcb889e3ed1fc4f6ed0.tar.xz
Add linked list generic type.
Diffstat (limited to 'vcal.c')
-rw-r--r--vcal.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/vcal.c b/vcal.c
index 7464c72b..0371a35b 100644
--- a/vcal.c
+++ b/vcal.c
@@ -7,6 +7,10 @@
#include "trie.inc.h"
#undef TYPE
+#define TYPE strbuf
+#include "linked_list.inc.h"
+#undef TYPE
+
content_line** clines;
int cline_ptr;
@@ -34,7 +38,8 @@ int add_content_line (vevent* ev, content_line* c) {
int CONSTRUCTOR_DECL(content_line) {
clines[cline_ptr++] = this;
CONSTRUCT(strbuf, &this->key);
- CONSTRUCT(strbuf, &this->val);
+ // CONSTRUCT(strbuf, &this->val);
+ CONSTRUCT( LLIST(strbuf), &this->vals );
// TODO remaining fields
return 0;
}
@@ -42,7 +47,10 @@ int CONSTRUCTOR_DECL(content_line) {
int CONSTRUCTOR_DECL(content_line, int keylen, int vallen) {
clines[cline_ptr++] = this;
CONSTRUCT(strbuf, &this->key, keylen);
- CONSTRUCT(strbuf, &this->val, vallen);
+ // CONSTRUCT(strbuf, &this->val, vallen);
+ CONSTRUCT( LLIST(strbuf), &this->vals );
+ NEW(strbuf, s, vallen);
+ LLIST_CONS(strbuf)(&this->vals, s);
// TODO remaining fields
return 0;
}
@@ -50,14 +58,16 @@ int CONSTRUCTOR_DECL(content_line, int keylen, int vallen) {
int content_line_copy (content_line* dest, content_line* src) {
strbuf_init_copy(&dest->key, &src->key);
- strbuf_init_copy(&dest->val, &src->val);
+ // strbuf_init_copy(&dest->val, &src->val);
+ DEEP_COPY(LLIST(strbuf))(&dest->vals, &src->vals);
// TODO remaining fields
return 0;
}
int FREE_DECL(content_line) {
FREE(strbuf)(&this->key);
- FREE(strbuf)(&this->val);
+ // FREE(strbuf)(&this->val);
+ LLIST_FREE(strbuf)(&this->vals);
for (int i = 0; i < cline_ptr; i++) {
if (clines[i] == this) {
clines[i] = NULL;