MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / yaml_mapping_start_event_initialize

Function yaml_mapping_start_event_initialize

xs/tools/yaml/api.c:949–982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947 */
948
949YAML_DECLARE(int)
950yaml_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
977error:
978 yaml_free(anchor_copy);
979 yaml_free(tag_copy);
980
981 return 0;
982}
983
984/*
985 * Create MAPPING-END.

Callers

nothing calls this directly

Calls 4

yaml_check_utf8Function · 0.85
yaml_strdupFunction · 0.85
yaml_freeFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected