summaryrefslogtreecommitdiff
path: root/keama/data.c
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2017-04-21 16:52:40 +0200
committerFrancis Dupont <fdupont@isc.org>2018-11-29 16:42:13 +0100
commitd904376d815e8275eaf88a7e9b611ffee611f20c (patch)
tree5aa75cda5276cec89728f0be901971598febde63 /keama/data.c
parentba9e4b40b2dbaf441a81476547f7527954886989 (diff)
downloadisc-dhcp-d904376d815e8275eaf88a7e9b611ffee611f20c.tar.gz
Checkpoint (wrote doc, began group)
Diffstat (limited to 'keama/data.c')
-rw-r--r--keama/data.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/keama/data.c b/keama/data.c
index 45ac72ac..78865f44 100644
--- a/keama/data.c
+++ b/keama/data.c
@@ -883,8 +883,8 @@ copy(struct element *e)
result->kind = e->kind;
result->skip = e->skip;
/* don't copy key */
+ /* copy comments */
TAILQ_FOREACH(comment, &e->comments) {
- /* share comment content */
comment = createComment(comment->line);
TAILQ_INSERT_TAIL(&result->comments, comment);
}
@@ -915,24 +915,28 @@ copyMap(struct element *m)
return result;
}
-isc_boolean_t
-derive(struct element *parent, struct element *child, const char *param)
+struct handle *
+mapPop(struct element *m)
{
- struct element *x;
- struct element *y;
+ struct element *item;
+ struct handle *h;
- assert(parent != NULL);
- assert(parent->type == ELEMENT_MAP);
- assert(child != NULL);
- assert(child->type == ELEMENT_MAP);
- assert(param != NULL);
+ assert(m != NULL);
+ assert(m->type == ELEMENT_MAP);
- x = mapGet(parent, param);
- if (x == NULL)
- return ISC_FALSE;
- y = mapGet(child, param);
- if (y != NULL)
- return ISC_FALSE;
- mapSet(child, x, param);
- return ISC_TRUE;
+ h = (struct handle *)malloc(sizeof(struct handle));
+ assert(h != NULL);
+ memset(h, 0, sizeof(struct handle));
+ TAILQ_INIT(&h->values);
+
+ item = TAILQ_FIRST(&m->value.map_value);
+ assert(item != NULL);
+ assert(item->key != NULL);
+ h->key = strdup(item->key);
+ assert(h->key != NULL);
+ h->value = item;
+
+ TAILQ_REMOVE(&m->value.map_value, item);
+
+ return h;
}