| 412 | */ |
| 413 | |
| 414 | static int |
| 415 | yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *event, |
| 416 | struct loader_ctx *ctx) |
| 417 | { |
| 418 | yaml_node_t node; |
| 419 | struct { |
| 420 | yaml_node_item_t *start; |
| 421 | yaml_node_item_t *end; |
| 422 | yaml_node_item_t *top; |
| 423 | } items = { NULL, NULL, NULL }; |
| 424 | int index; |
| 425 | yaml_char_t *tag = event->data.sequence_start.tag; |
| 426 | |
| 427 | if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error; |
| 428 | |
| 429 | if (!tag || strcmp((char *)tag, "!") == 0) { |
| 430 | yaml_free(tag); |
| 431 | tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG); |
| 432 | if (!tag) goto error; |
| 433 | } |
| 434 | |
| 435 | if (!STACK_INIT(parser, items, yaml_node_item_t*)) goto error; |
| 436 | |
| 437 | SEQUENCE_NODE_INIT(node, tag, items.start, items.end, |
| 438 | event->data.sequence_start.style, |
| 439 | event->start_mark, event->end_mark); |
| 440 | |
| 441 | if (!PUSH(parser, parser->document->nodes, node)) goto error; |
| 442 | |
| 443 | index = parser->document->nodes.top - parser->document->nodes.start; |
| 444 | |
| 445 | if (!yaml_parser_register_anchor(parser, index, |
| 446 | event->data.sequence_start.anchor)) return 0; |
| 447 | |
| 448 | if (!yaml_parser_load_node_add(parser, ctx, index)) return 0; |
| 449 | |
| 450 | if (!STACK_LIMIT(parser, *ctx, INT_MAX-1)) return 0; |
| 451 | if (!PUSH(parser, *ctx, index)) return 0; |
| 452 | |
| 453 | return 1; |
| 454 | |
| 455 | error: |
| 456 | yaml_free(tag); |
| 457 | yaml_free(event->data.sequence_start.anchor); |
| 458 | return 0; |
| 459 | } |
| 460 | |
| 461 | static int |
| 462 | yaml_parser_load_sequence_end(yaml_parser_t *parser, yaml_event_t *event, |
no test coverage detected