diff options
-rw-r--r-- | vcal.c | 23 | ||||
-rw-r--r-- | vcal.h | 14 |
2 files changed, 30 insertions, 7 deletions
@@ -54,8 +54,18 @@ content_line* RESOLVE(content_line) return NULL; } + /* + * This destroys new. + */ APPEND(LLIST(strbuf)) (&dest->vals, &new->vals); + INFO_F("param length = %i", SIZE(LLIST(strbuf))(&new->params)); + FOR(LLIST(strbuf), link, &new->params) { + INFO_F("| %s", link->value->mem); + } + + APPEND(LLIST(strbuf)) (&dest->params, &new->params); + FREE(strbuf)(&new->key); free(new); @@ -70,7 +80,7 @@ INIT_F(content_line) { INIT(strbuf, &this->key); INIT( LLIST(strbuf), &this->vals ); - // TODO remaining fields + INIT( LLIST(strbuf), &this->params ); return 0; } @@ -81,7 +91,7 @@ INIT_F(content_line, int keylen, int vallen) { NEW(strbuf, s, vallen); PUSH(LLIST(strbuf))(&this->vals, s); - // TODO remaining fields + INIT( LLIST(strbuf), &this->params ); return 0; } @@ -90,16 +100,19 @@ FREE_F(content_line) { FREE(strbuf)(&this->key); FREE(LLIST(strbuf))(&this->vals); - // TODO remaining fields + FREE(LLIST(strbuf))(&this->params); return 0; } int content_line_copy (content_line* dest, content_line* src) { + if (! EMPTY(LLIST(strbuf))(&src->params)) { + INFO_F("[%s] : %s", src->key.mem, FIRST_V(&src->params)->mem); + } + DEEP_COPY(strbuf)(&dest->key, &src->key); DEEP_COPY(LLIST(strbuf))(&dest->vals, &src->vals); - - // TODO remaining fields + DEEP_COPY(LLIST(strbuf))(&dest->params, &src->params); return 0; } @@ -7,22 +7,32 @@ #define TYPE strbuf #include "linked_list.h" +// #include "trie.h" #undef TYPE +/* typedef struct { strbuf key; strbuf value; + strbuf* vals; int val_count; } parameter; +*/ + +typedef struct { + strbuf key; + strbuf val; +} key_val; typedef struct { strbuf key; LLIST(strbuf) vals; - parameter* params; - int param_count; + /* parcams NULL by default, since most content lines doesn't have + * any properties */ + LLIST(strbuf) params; } content_line; INIT_F(content_line); |