]> andersk Git - libyaml.git/blobdiff - src/api.c
Imported Upstream version 0.1.3
[libyaml.git] / src / api.c
index f5d5cd2dd0bdd6489bee99588d6817b0917ec74d..0c4732e1520d227dfb537429c6b3e815b42865e3 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -1118,9 +1118,11 @@ yaml_document_delete(yaml_document_t *document)
 {
     struct {
         yaml_error_type_t error;
-    } context = { YAML_NO_ERROR };
+    } context;
     yaml_tag_directive_t *tag_directive;
 
+    context.error = YAML_NO_ERROR;  /* Eliminate a compliler warning. */
+
     assert(document);   /* Non-NULL document object is expected. */
 
     while (!STACK_EMPTY(&context, document->nodes)) {
@@ -1159,12 +1161,12 @@ yaml_document_delete(yaml_document_t *document)
  */
 
 YAML_DECLARE(yaml_node_t *)
-yaml_document_get_node(yaml_document_t *document, int node)
+yaml_document_get_node(yaml_document_t *document, int index)
 {
     assert(document);   /* Non-NULL document object is expected. */
 
-    if (node > 0 && document->nodes.start + node <= document->nodes.top) {
-        return document->nodes.start + node - 1;
+    if (index > 0 && document->nodes.start + index <= document->nodes.top) {
+        return document->nodes.start + index - 1;
     }
     return NULL;
 }
@@ -1205,7 +1207,7 @@ yaml_document_add_scalar(yaml_document_t *document,
     assert(value);      /* Non-NULL value is expected. */
 
     if (!tag) {
-        tag = YAML_DEFAULT_SCALAR_TAG;
+        tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG;
     }
 
     if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
@@ -1257,7 +1259,7 @@ yaml_document_add_sequence(yaml_document_t *document,
     assert(document);   /* Non-NULL document object is expected. */
 
     if (!tag) {
-        tag = YAML_DEFAULT_SEQUENCE_TAG;
+        tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG;
     }
 
     if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
@@ -1302,7 +1304,7 @@ yaml_document_add_mapping(yaml_document_t *document,
     assert(document);   /* Non-NULL document object is expected. */
 
     if (!tag) {
-        tag = YAML_DEFAULT_MAPPING_TAG;
+        tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG;
     }
 
     if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
@@ -1363,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
@@ -1376,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;
This page took 0.029059 seconds and 4 git commands to generate.