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

Function yaml_sequence_start_event_initialize

xs/tools/yaml/api.c:894–927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892 */
893
894YAML_DECLARE(int)
895yaml_sequence_start_event_initialize(yaml_event_t *event,
896 yaml_char_t *anchor, yaml_char_t *tag, int implicit,
897 yaml_sequence_style_t style)
898{
899 yaml_mark_t mark = { 0, 0, 0 };
900 yaml_char_t *anchor_copy = NULL;
901 yaml_char_t *tag_copy = NULL;
902
903 assert(event); /* Non-NULL event object is expected. */
904
905 if (anchor) {
906 if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error;
907 anchor_copy = yaml_strdup(anchor);
908 if (!anchor_copy) goto error;
909 }
910
911 if (tag) {
912 if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
913 tag_copy = yaml_strdup(tag);
914 if (!tag_copy) goto error;
915 }
916
917 SEQUENCE_START_EVENT_INIT(*event, anchor_copy, tag_copy,
918 implicit, style, mark, mark);
919
920 return 1;
921
922error:
923 yaml_free(anchor_copy);
924 yaml_free(tag_copy);
925
926 return 0;
927}
928
929/*
930 * Create SEQUENCE-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