| 947 | */ |
| 948 | |
| 949 | YAML_DECLARE(int) |
| 950 | yaml_mapping_start_event_initialize(yaml_event_t *event, |
| 951 | yaml_char_t *anchor, yaml_char_t *tag, int implicit, |
| 952 | yaml_mapping_style_t style) |
| 953 | { |
| 954 | yaml_mark_t mark = { 0, 0, 0 }; |
| 955 | yaml_char_t *anchor_copy = NULL; |
| 956 | yaml_char_t *tag_copy = NULL; |
| 957 | |
| 958 | assert(event); /* Non-NULL event object is expected. */ |
| 959 | |
| 960 | if (anchor) { |
| 961 | if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error; |
| 962 | anchor_copy = yaml_strdup(anchor); |
| 963 | if (!anchor_copy) goto error; |
| 964 | } |
| 965 | |
| 966 | if (tag) { |
| 967 | if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; |
| 968 | tag_copy = yaml_strdup(tag); |
| 969 | if (!tag_copy) goto error; |
| 970 | } |
| 971 | |
| 972 | MAPPING_START_EVENT_INIT(*event, anchor_copy, tag_copy, |
| 973 | implicit, style, mark, mark); |
| 974 | |
| 975 | return 1; |
| 976 | |
| 977 | error: |
| 978 | yaml_free(anchor_copy); |
| 979 | yaml_free(tag_copy); |
| 980 | |
| 981 | return 0; |
| 982 | } |
| 983 | |
| 984 | /* |
| 985 | * Create MAPPING-END. |
nothing calls this directly
no test coverage detected