| line |
true |
false |
branch |
|
33
|
3434 |
0 |
return malloc(size ? size : 1); |
|
43
|
66 |
0 |
return ptr ? realloc(ptr, size ? size : 1) : malloc(size ? size : 1); |
|
|
66 |
0 |
return ptr ? realloc(ptr, size ? size : 1) : malloc(size ? size : 1); |
|
|
0 |
0 |
return ptr ? realloc(ptr, size ? size : 1) : malloc(size ? size : 1); |
|
53
|
4643 |
2204 |
if (ptr) free(ptr); |
|
63
|
0 |
1219 |
if (!str) |
|
79
|
0 |
66 |
if ((char *)*end - (char *)*start >= INT_MAX / 2) |
|
83
|
0 |
66 |
if (!new_start) return 0; |
|
104
|
24 |
61 |
if (*b_start == *b_pointer) |
|
107
|
0 |
61 |
while (*a_end - *a_pointer <= *b_pointer - *b_start) { |
|
108
|
0 |
0 |
if (!yaml_string_extend(a_start, a_pointer, a_end)) |
|
127
|
0 |
0 |
if ((char *)*end - (char *)*start >= INT_MAX / 2) |
|
131
|
0 |
0 |
if (!new_start) return 0; |
|
149
|
0 |
48 |
if (*start == *head && *tail == *end) { |
|
|
0 |
0 |
if (*start == *head && *tail == *end) { |
|
153
|
0 |
0 |
if (!new_start) return 0; |
|
163
|
48 |
0 |
if (*tail == *end) { |
|
164
|
26 |
22 |
if (*head != *tail) { |
|
182
|
0 |
109 |
assert(parser); /* Non-NULL parser object expected. */ |
|
185
|
109 |
0 |
if (!BUFFER_INIT(parser, parser->raw_buffer, INPUT_RAW_BUFFER_SIZE)) |
|
|
0 |
109 |
if (!BUFFER_INIT(parser, parser->raw_buffer, INPUT_RAW_BUFFER_SIZE)) |
|
187
|
109 |
0 |
if (!BUFFER_INIT(parser, parser->buffer, INPUT_BUFFER_SIZE)) |
|
|
0 |
109 |
if (!BUFFER_INIT(parser, parser->buffer, INPUT_BUFFER_SIZE)) |
|
189
|
109 |
0 |
if (!QUEUE_INIT(parser, parser->tokens, INITIAL_QUEUE_SIZE, yaml_token_t*)) |
|
|
0 |
109 |
if (!QUEUE_INIT(parser, parser->tokens, INITIAL_QUEUE_SIZE, yaml_token_t*)) |
|
191
|
109 |
0 |
if (!STACK_INIT(parser, parser->indents, int*)) |
|
|
0 |
109 |
if (!STACK_INIT(parser, parser->indents, int*)) |
|
193
|
109 |
0 |
if (!STACK_INIT(parser, parser->simple_keys, yaml_simple_key_t*)) |
|
|
0 |
109 |
if (!STACK_INIT(parser, parser->simple_keys, yaml_simple_key_t*)) |
|
195
|
109 |
0 |
if (!STACK_INIT(parser, parser->states, yaml_parser_state_t*)) |
|
|
0 |
109 |
if (!STACK_INIT(parser, parser->states, yaml_parser_state_t*)) |
|
197
|
109 |
0 |
if (!STACK_INIT(parser, parser->marks, yaml_mark_t*)) |
|
|
0 |
109 |
if (!STACK_INIT(parser, parser->marks, yaml_mark_t*)) |
|
199
|
109 |
0 |
if (!STACK_INIT(parser, parser->tag_directives, yaml_tag_directive_t*)) |
|
|
0 |
109 |
if (!STACK_INIT(parser, parser->tag_directives, yaml_tag_directive_t*)) |
|
225
|
0 |
131 |
assert(parser); /* Non-NULL parser object expected. */ |
|
229
|
1 |
131 |
while (!QUEUE_EMPTY(parser, parser->tokens)) { |
|
237
|
12 |
131 |
while (!STACK_EMPTY(parser, parser->tag_directives)) { |
|
257
|
99 |
103 |
if (parser->input.string.current == parser->input.string.end) { |
|
262
|
103 |
0 |
if (size > (size_t)(parser->input.string.end |
|
295
|
0 |
104 |
assert(parser); /* Non-NULL parser object expected. */ |
|
296
|
0 |
104 |
assert(!parser->read_handler); /* You can set the source only once. */ |
|
297
|
0 |
104 |
assert(input); /* Non-NULL input string expected. */ |
|
314
|
0 |
3 |
assert(parser); /* Non-NULL parser object expected. */ |
|
315
|
0 |
3 |
assert(!parser->read_handler); /* You can set the source only once. */ |
|
316
|
0 |
3 |
assert(file); /* Non-NULL file object expected. */ |
|
332
|
0 |
2 |
assert(parser); /* Non-NULL parser object expected. */ |
|
333
|
0 |
2 |
assert(!parser->read_handler); /* You can set the source only once. */ |
|
334
|
0 |
2 |
assert(handler); /* Non-NULL read handler expected. */ |
|
347
|
0 |
0 |
assert(parser); /* Non-NULL parser object expected. */ |
|
348
|
0 |
0 |
assert(!parser->encoding); /* Encoding is already set or detected. */ |
|
360
|
0 |
87 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
363
|
87 |
0 |
if (!BUFFER_INIT(emitter, emitter->buffer, OUTPUT_BUFFER_SIZE)) |
|
|
0 |
87 |
if (!BUFFER_INIT(emitter, emitter->buffer, OUTPUT_BUFFER_SIZE)) |
|
365
|
87 |
0 |
if (!BUFFER_INIT(emitter, emitter->raw_buffer, OUTPUT_RAW_BUFFER_SIZE)) |
|
|
0 |
87 |
if (!BUFFER_INIT(emitter, emitter->raw_buffer, OUTPUT_RAW_BUFFER_SIZE)) |
|
367
|
87 |
0 |
if (!STACK_INIT(emitter, emitter->states, yaml_emitter_state_t*)) |
|
|
0 |
87 |
if (!STACK_INIT(emitter, emitter->states, yaml_emitter_state_t*)) |
|
369
|
87 |
0 |
if (!QUEUE_INIT(emitter, emitter->events, INITIAL_QUEUE_SIZE, yaml_event_t*)) |
|
|
0 |
87 |
if (!QUEUE_INIT(emitter, emitter->events, INITIAL_QUEUE_SIZE, yaml_event_t*)) |
|
371
|
87 |
0 |
if (!STACK_INIT(emitter, emitter->indents, int*)) |
|
|
0 |
87 |
if (!STACK_INIT(emitter, emitter->indents, int*)) |
|
373
|
87 |
0 |
if (!STACK_INIT(emitter, emitter->tag_directives, yaml_tag_directive_t*)) |
|
|
0 |
87 |
if (!STACK_INIT(emitter, emitter->tag_directives, yaml_tag_directive_t*)) |
|
397
|
0 |
110 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
402
|
0 |
110 |
while (!QUEUE_EMPTY(emitter, emitter->events)) { |
|
407
|
0 |
110 |
while (!STACK_EMPTY(empty, emitter->tag_directives)) { |
|
427
|
0 |
0 |
if (emitter->output.string.size - *emitter->output.string.size_written |
|
463
|
0 |
0 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
464
|
0 |
0 |
assert(!emitter->write_handler); /* You can set the output only once. */ |
|
465
|
0 |
0 |
assert(output); /* Non-NULL output string expected. */ |
|
483
|
0 |
2 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
484
|
0 |
2 |
assert(!emitter->write_handler); /* You can set the output only once. */ |
|
485
|
0 |
2 |
assert(file); /* Non-NULL file object expected. */ |
|
501
|
0 |
85 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
502
|
0 |
85 |
assert(!emitter->write_handler); /* You can set the output only once. */ |
|
503
|
0 |
85 |
assert(handler); /* Non-NULL handler object expected. */ |
|
516
|
0 |
0 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
517
|
0 |
0 |
assert(!emitter->encoding); /* You can set encoding only once. */ |
|
529
|
0 |
87 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
541
|
0 |
87 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
543
|
87 |
0 |
emitter->best_indent = (1 < indent && indent < 10) ? indent : 2; |
|
|
87 |
0 |
emitter->best_indent = (1 < indent && indent < 10) ? indent : 2; |
|
553
|
0 |
87 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
565
|
0 |
87 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
577
|
0 |
0 |
assert(emitter); /* Non-NULL emitter object expected. */ |
|
589
|
0 |
1 |
assert(token); /* Non-NULL token object expected. */ |
|
634
|
9460 |
626 |
while (pointer < end) { |
|
641
|
73 |
9387 |
width = (octet & 0x80) == 0x00 ? 1 : |
|
|
57 |
16 |
width = (octet & 0x80) == 0x00 ? 1 : |
|
|
0 |
57 |
width = (octet & 0x80) == 0x00 ? 1 : |
|
|
0 |
0 |
width = (octet & 0x80) == 0x00 ? 1 : |
|
645
|
9387 |
73 |
value = (octet & 0x80) == 0x00 ? octet & 0x7F : |
|
|
16 |
57 |
value = (octet & 0x80) == 0x00 ? octet & 0x7F : |
|
|
57 |
0 |
value = (octet & 0x80) == 0x00 ? octet & 0x7F : |
|
|
0 |
0 |
value = (octet & 0x80) == 0x00 ? octet & 0x7F : |
|
649
|
0 |
9460 |
if (!width) return 0; |
|
650
|
0 |
9460 |
if (pointer+width > end) return 0; |
|
651
|
130 |
9460 |
for (k = 1; k < width; k ++) { |
|
653
|
0 |
130 |
if ((octet & 0xC0) != 0x80) return 0; |
|
656
|
73 |
9387 |
if (!((width == 1) || |
|
|
16 |
57 |
if (!((width == 1) || |
|
|
0 |
0 |
if (!((width == 1) || |
|
657
|
0 |
16 |
(width == 2 && value >= 0x80) || |
|
|
57 |
0 |
(width == 2 && value >= 0x80) || |
|
658
|
0 |
57 |
(width == 3 && value >= 0x800) || |
|
659
|
0 |
0 |
(width == 4 && value >= 0x10000))) return 0; |
|
677
|
0 |
87 |
assert(event); /* Non-NULL event object is expected. */ |
|
693
|
0 |
87 |
assert(event); /* Non-NULL event object is expected. */ |
|
723
|
0 |
109 |
assert(event); /* Non-NULL event object is expected. */ |
|
724
|
0 |
109 |
assert((tag_directives_start && tag_directives_end) || |
|
|
0 |
0 |
assert((tag_directives_start && tag_directives_end) || |
|
|
0 |
109 |
assert((tag_directives_start && tag_directives_end) || |
|
728
|
0 |
109 |
if (version_directive) { |
|
730
|
0 |
0 |
if (!version_directive_copy) goto error; |
|
735
|
0 |
109 |
if (tag_directives_start != tag_directives_end) { |
|
737
|
0 |
0 |
if (!STACK_INIT(&context, tag_directives_copy, yaml_tag_directive_t*)) |
|
|
0 |
0 |
if (!STACK_INIT(&context, tag_directives_copy, yaml_tag_directive_t*)) |
|
739
|
0 |
0 |
for (tag_directive = tag_directives_start; |
|
741
|
0 |
0 |
assert(tag_directive->handle); |
|
742
|
0 |
0 |
assert(tag_directive->prefix); |
|
743
|
0 |
0 |
if (!yaml_check_utf8(tag_directive->handle, |
|
746
|
0 |
0 |
if (!yaml_check_utf8(tag_directive->prefix, |
|
751
|
0 |
0 |
if (!value.handle || !value.prefix) goto error; |
|
|
0 |
0 |
if (!value.handle || !value.prefix) goto error; |
|
752
|
0 |
0 |
if (!PUSH(&context, tag_directives_copy, value)) |
|
|
0 |
0 |
if (!PUSH(&context, tag_directives_copy, value)) |
|
|
0 |
0 |
if (!PUSH(&context, tag_directives_copy, value)) |
|
767
|
0 |
0 |
while (!STACK_EMPTY(context, tag_directives_copy)) { |
|
788
|
0 |
109 |
assert(event); /* Non-NULL emitter object is expected. */ |
|
805
|
0 |
17 |
assert(event); /* Non-NULL event object is expected. */ |
|
806
|
0 |
17 |
assert(anchor); /* Non-NULL anchor is expected. */ |
|
808
|
0 |
17 |
if (!yaml_check_utf8(anchor, strlen((char *)anchor))) return 0; |
|
811
|
0 |
17 |
if (!anchor_copy) |
|
835
|
0 |
291 |
assert(event); /* Non-NULL event object is expected. */ |
|
836
|
0 |
291 |
assert(value); /* Non-NULL anchor is expected. */ |
|
838
|
0 |
291 |
if (anchor) { |
|
839
|
0 |
0 |
if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error; |
|
841
|
0 |
0 |
if (!anchor_copy) goto error; |
|
844
|
272 |
19 |
if (tag) { |
|
845
|
0 |
272 |
if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; |
|
847
|
0 |
272 |
if (!tag_copy) goto error; |
|
850
|
0 |
291 |
if (length < 0) { |
|
854
|
0 |
291 |
if (!yaml_check_utf8(value, length)) goto error; |
|
856
|
0 |
291 |
if (!value_copy) goto error; |
|
886
|
0 |
44 |
assert(event); /* Non-NULL event object is expected. */ |
|
888
|
6 |
38 |
if (anchor) { |
|
889
|
0 |
6 |
if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error; |
|
891
|
0 |
6 |
if (!anchor_copy) goto error; |
|
894
|
3 |
41 |
if (tag) { |
|
895
|
0 |
3 |
if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; |
|
897
|
0 |
3 |
if (!tag_copy) goto error; |
|
921
|
0 |
44 |
assert(event); /* Non-NULL event object is expected. */ |
|
941
|
0 |
66 |
assert(event); /* Non-NULL event object is expected. */ |
|
943
|
10 |
56 |
if (anchor) { |
|
944
|
0 |
10 |
if (!yaml_check_utf8(anchor, strlen((char *)anchor))) goto error; |
|
946
|
0 |
10 |
if (!anchor_copy) goto error; |
|
949
|
27 |
39 |
if (tag) { |
|
950
|
0 |
27 |
if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; |
|
952
|
0 |
27 |
if (!tag_copy) goto error; |
|
976
|
0 |
66 |
assert(event); /* Non-NULL event object is expected. */ |
|
992
|
0 |
1749 |
assert(event); /* Non-NULL event object expected. */ |
|
998
|
0 |
215 |
for (tag_directive = event->data.document_start.tag_directives.start; |
|
1062
|
0 |
0 |
assert(document); /* Non-NULL document object is expected. */ |
|
1063
|
0 |
0 |
assert((tag_directives_start && tag_directives_end) || |
|
|
0 |
0 |
assert((tag_directives_start && tag_directives_end) || |
|
|
0 |
0 |
assert((tag_directives_start && tag_directives_end) || |
|
1067
|
0 |
0 |
if (!STACK_INIT(&context, nodes, yaml_node_t*)) goto error; |
|
|
0 |
0 |
if (!STACK_INIT(&context, nodes, yaml_node_t*)) goto error; |
|
1069
|
0 |
0 |
if (version_directive) { |
|
1071
|
0 |
0 |
if (!version_directive_copy) goto error; |
|
1076
|
0 |
0 |
if (tag_directives_start != tag_directives_end) { |
|
1078
|
0 |
0 |
if (!STACK_INIT(&context, tag_directives_copy, yaml_tag_directive_t*)) |
|
|
0 |
0 |
if (!STACK_INIT(&context, tag_directives_copy, yaml_tag_directive_t*)) |
|
1080
|
0 |
0 |
for (tag_directive = tag_directives_start; |
|
1082
|
0 |
0 |
assert(tag_directive->handle); |
|
1083
|
0 |
0 |
assert(tag_directive->prefix); |
|
1084
|
0 |
0 |
if (!yaml_check_utf8(tag_directive->handle, |
|
1087
|
0 |
0 |
if (!yaml_check_utf8(tag_directive->prefix, |
|
1092
|
0 |
0 |
if (!value.handle || !value.prefix) goto error; |
|
|
0 |
0 |
if (!value.handle || !value.prefix) goto error; |
|
1093
|
0 |
0 |
if (!PUSH(&context, tag_directives_copy, value)) |
|
|
0 |
0 |
if (!PUSH(&context, tag_directives_copy, value)) |
|
|
0 |
0 |
if (!PUSH(&context, tag_directives_copy, value)) |
|
1109
|
0 |
0 |
while (!STACK_EMPTY(&context, tag_directives_copy)) { |
|
1130
|
0 |
0 |
assert(document); /* Non-NULL document object is expected. */ |
|
1132
|
0 |
0 |
while (!STACK_EMPTY(&context, document->nodes)) { |
|
1152
|
0 |
0 |
for (tag_directive = document->tag_directives.start; |
|
1170
|
0 |
0 |
assert(document); /* Non-NULL document object is expected. */ |
|
1172
|
0 |
0 |
if (index > 0 && document->nodes.start + index <= document->nodes.top) { |
|
|
0 |
0 |
if (index > 0 && document->nodes.start + index <= document->nodes.top) { |
|
1185
|
0 |
0 |
assert(document); /* Non-NULL document object is expected. */ |
|
1187
|
0 |
0 |
if (document->nodes.top != document->nodes.start) { |
|
1210
|
0 |
0 |
assert(document); /* Non-NULL document object is expected. */ |
|
1211
|
0 |
0 |
assert(value); /* Non-NULL value is expected. */ |
|
1213
|
0 |
0 |
if (!tag) { |
|
1217
|
0 |
0 |
if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; |
|
1219
|
0 |
0 |
if (!tag_copy) goto error; |
|
1221
|
0 |
0 |
if (length < 0) { |
|
1225
|
0 |
0 |
if (!yaml_check_utf8(value, length)) goto error; |
|
1227
|
0 |
0 |
if (!value_copy) goto error; |
|
1232
|
0 |
0 |
if (!PUSH(&context, document->nodes, node)) goto error; |
|
|
0 |
0 |
if (!PUSH(&context, document->nodes, node)) goto error; |
|
|
0 |
0 |
if (!PUSH(&context, document->nodes, node)) goto error; |
|
1263
|
0 |
0 |
assert(document); /* Non-NULL document object is expected. */ |
|
1265
|
0 |
0 |
if (!tag) { |
|
1269
|
0 |
0 |
if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; |
|
1271
|
0 |
0 |
if (!tag_copy) goto error; |
|
1273
|
0 |
0 |
if (!STACK_INIT(&context, items, yaml_node_item_t*)) goto error; |
|
|
0 |
0 |
if (!STACK_INIT(&context, items, yaml_node_item_t*)) goto error; |
|
1277
|
0 |
0 |
if (!PUSH(&context, document->nodes, node)) goto error; |
|
|
0 |
0 |
if (!PUSH(&context, document->nodes, node)) goto error; |
|
|
0 |
0 |
if (!PUSH(&context, document->nodes, node)) goto error; |
|
1308
|
0 |
0 |
assert(document); /* Non-NULL document object is expected. */ |
|
1310
|
0 |
0 |
if (!tag) { |
|
1314
|
0 |
0 |
if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; |
|
1316
|
0 |
0 |
if (!tag_copy) goto error; |
|
1318
|
0 |
0 |
if (!STACK_INIT(&context, pairs, yaml_node_pair_t*)) goto error; |
|
|
0 |
0 |
if (!STACK_INIT(&context, pairs, yaml_node_pair_t*)) goto error; |
|
1322
|
0 |
0 |
if (!PUSH(&context, document->nodes, node)) goto error; |
|
|
0 |
0 |
if (!PUSH(&context, document->nodes, node)) goto error; |
|
|
0 |
0 |
if (!PUSH(&context, document->nodes, node)) goto error; |
|
1345
|
0 |
0 |
assert(document); /* Non-NULL document is required. */ |
|
1346
|
0 |
0 |
assert(sequence > 0 |
|
|
0 |
0 |
assert(sequence > 0 |
|
1349
|
0 |
0 |
assert(document->nodes.start[sequence-1].type == YAML_SEQUENCE_NODE); |
|
1351
|
0 |
0 |
assert(item > 0 && document->nodes.start + item <= document->nodes.top); |
|
|
0 |
0 |
assert(item > 0 && document->nodes.start + item <= document->nodes.top); |
|
1354
|
0 |
0 |
if (!PUSH(&context, |
|
|
0 |
0 |
if (!PUSH(&context, |
|
|
0 |
0 |
if (!PUSH(&context, |
|
1375
|
0 |
0 |
assert(document); /* Non-NULL document is required. */ |
|
1376
|
0 |
0 |
assert(mapping > 0 |
|
|
0 |
0 |
assert(mapping > 0 |
|
1379
|
0 |
0 |
assert(document->nodes.start[mapping-1].type == YAML_MAPPING_NODE); |
|
1381
|
0 |
0 |
assert(key > 0 && document->nodes.start + key <= document->nodes.top); |
|
|
0 |
0 |
assert(key > 0 && document->nodes.start + key <= document->nodes.top); |
|
1383
|
0 |
0 |
assert(value > 0 && document->nodes.start + value <= document->nodes.top); |
|
|
0 |
0 |
assert(value > 0 && document->nodes.start + value <= document->nodes.top); |
|
1389
|
0 |
0 |
if (!PUSH(&context, |
|
|
0 |
0 |
if (!PUSH(&context, |
|
|
0 |
0 |
if (!PUSH(&context, |