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

Function yaml_token_delete

xs/tools/yaml/api.c:603–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601 */
602
603YAML_DECLARE(void)
604yaml_token_delete(yaml_token_t *token)
605{
606 assert(token); /* Non-NULL token object expected. */
607
608 switch (token->type)
609 {
610 case YAML_TAG_DIRECTIVE_TOKEN:
611 yaml_free(token->data.tag_directive.handle);
612 yaml_free(token->data.tag_directive.prefix);
613 break;
614
615 case YAML_ALIAS_TOKEN:
616 yaml_free(token->data.alias.value);
617 break;
618
619 case YAML_ANCHOR_TOKEN:
620 yaml_free(token->data.anchor.value);
621 break;
622
623 case YAML_TAG_TOKEN:
624 yaml_free(token->data.tag.handle);
625 yaml_free(token->data.tag.suffix);
626 break;
627
628 case YAML_SCALAR_TOKEN:
629 yaml_free(token->data.scalar.value);
630 break;
631
632 default:
633 break;
634 }
635
636 memset(token, 0, sizeof(yaml_token_t));
637}
638
639/*
640 * Check if a string is a valid UTF-8 sequence.

Callers 8

yaml_parser_fetch_anchorFunction · 0.85
yaml_parser_fetch_tagFunction · 0.85
yaml_parser_deleteFunction · 0.85
yaml.hFile · 0.85

Calls 2

yaml_freeFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected