X-Git-Url: http://andersk.mit.edu/gitweb/libyaml.git/blobdiff_plain/c9b74def08ff0fcac2f1466652b432e4c3129b35..47dc80f676736d4da3772d662ca0602b8f2b721c:/src/api.c diff --git a/src/api.c b/src/api.c index 02e7b14..0c4732e 100644 --- a/src/api.c +++ b/src/api.c @@ -1365,7 +1365,8 @@ yaml_document_append_mapping_pair(yaml_document_t *document, struct { yaml_error_type_t error; } context; - yaml_node_pair_t pair = { key, value }; + + yaml_node_pair_t pair; assert(document); /* Non-NULL document is required. */ assert(mapping > 0 @@ -1378,6 +1379,9 @@ yaml_document_append_mapping_pair(yaml_document_t *document, assert(value > 0 && document->nodes.start + value <= document->nodes.top); /* Valid value id is required. */ + pair.key = key; + pair.value = value; + if (!PUSH(&context, document->nodes.start[mapping-1].data.mapping.pairs, pair)) return 0;