Function yaml_sequence_start_event_initialize

Synopsis

#include <include/yaml.h>

int yaml_sequence_start_event_initialize(yaml_event_t *event, const yaml_char_t *anchor, const yaml_char_t *tag, int implicit, yaml_sequence_style_t style)

Description

Create a SEQUENCE-START event.

The style argument may be ignored by the emitter.

Either the tag attribute or the implicit flag must be set.

Parameters:

[ out ] event - An empty event object.

[ in ] anchor - The sequence anchor or NULL.

[ in ] tag - The sequence tag or NULL.

[ in ] implicit - If the tag may be omitted.

[ in ] style - The sequence style.

Return
1 if the function succeeded, 0 on error.
Create SEQUENCE-START.

Source

Lines 874-907 in src/api.c. Line 603 in include/yaml.h.

YAML_DECLARE(int)
yaml_sequence_start_event_initialize(yaml_event_t *event,
        const yaml_char_t *anchor, const yaml_char_t *tag, int implicit,
        yaml_sequence_style_t style)
{
    yaml_mark_t mark = { 0, 0, 0 };
    yaml_char_t *anchor_copy = NULL;
    yaml_char_t *tag_copy = NULL;

    assert(event);      /* Non-NULL event object is expected. */

    if (anchor) {
        if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error;
        anchor_copy = yaml_strdup(anchor);
        if (!anchor_copy) goto error;
    }

    if (tag) {
        if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
        tag_copy = yaml_strdup(tag);
        if (!tag_copy) goto error;
    }

    SEQUENCE_START_EVENT_INIT(*event, anchor_copy, tag_copy,
            implicit, style, mark, mark);

    return 1;

error:
    yaml_free(anchor_copy);
    yaml_free(tag_copy);

    return 0;
}





Add Discussion as Guest

Log in to DocsForge