]> andersk Git - libyaml.git/blobdiff - src/api.c
Add two examples and prepare the build system for distribution.
[libyaml.git] / src / api.c
index 1b9b2a2ecebef76ff72ebfb4f507e39fbdeca323..83ca720c1d19f835da7f284ba225edfc3a0dc0a6 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -391,6 +391,7 @@ yaml_emitter_delete(yaml_emitter_t *emitter)
     while (!QUEUE_EMPTY(emitter, emitter->events)) {
         yaml_event_delete(&DEQUEUE(emitter, emitter->events));
     }
+    QUEUE_DEL(emitter, emitter->events);
     STACK_DEL(emitter, emitter->indents);
     while (!STACK_EMPTY(empty, emitter->tag_directives)) {
         yaml_tag_directive_t tag_directive = POP(emitter, emitter->tag_directives);
@@ -744,7 +745,7 @@ yaml_document_start_event_initialize(yaml_event_t *event,
     }
 
     DOCUMENT_START_EVENT_INIT(*event, version_directive_copy,
-            tag_directives_copy.start, tag_directives_copy.end,
+            tag_directives_copy.start, tag_directives_copy.top,
             implicit, mark, mark);
 
     return 1;
@@ -810,7 +811,7 @@ yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor)
 YAML_DECLARE(int)
 yaml_scalar_event_initialize(yaml_event_t *event,
         yaml_char_t *anchor, yaml_char_t *tag,
-        yaml_char_t *value, size_t length,
+        yaml_char_t *value, int length,
         int plain_implicit, int quoted_implicit,
         yaml_scalar_style_t style)
 {
@@ -822,7 +823,6 @@ yaml_scalar_event_initialize(yaml_event_t *event,
     assert(event);      /* Non-NULL event object is expected. */
     assert(value);      /* Non-NULL anchor is expected. */
 
-
     if (anchor) {
         if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error;
         anchor_copy = yaml_strdup(anchor);
@@ -835,6 +835,10 @@ yaml_scalar_event_initialize(yaml_event_t *event,
         if (!tag_copy) goto error;
     }
 
+    if (length < 0) {
+        length = strlen((char *)value);
+    }
+
     if (!yaml_check_utf8(value, length)) goto error;
     value_copy = yaml_malloc(length+1);
     if (!value_copy) goto error;
This page took 0.036564 seconds and 4 git commands to generate.