* Close a "level", either a container or an instance. */
| 460 | * Close a "level", either a container or an instance. |
| 461 | */ |
| 462 | static int |
| 463 | csv_close_level (xo_handle_t *xop UNUSED, csv_private_t *csv, const char *name) |
| 464 | { |
| 465 | /* If we're recording, a close triggers an emit */ |
| 466 | if (csv->c_flags & CF_RECORD_DATA) { |
| 467 | csv->c_flags &= ~CF_RECORD_DATA; |
| 468 | csv_emit_record(xop, csv); |
| 469 | } |
| 470 | |
| 471 | const char *path_top = csv_path_top(csv, -1); |
| 472 | csv_dbg(xop, csv, "csv: close: [%s] [%s] (%zd)\n", name, |
| 473 | path_top ?: "", csv->c_path_cur); |
| 474 | |
| 475 | /* If the top of the stack does not match the name, then ignore */ |
| 476 | if (path_top != NULL && xo_streq(path_top, name)) { |
| 477 | csv->c_path_cur -= 1; |
| 478 | return 0; |
| 479 | } |
| 480 | |
| 481 | /* Pop the name off the stack */ |
| 482 | csv_stack_pop(csv, name); |
| 483 | |
| 484 | return 0; |
| 485 | } |
| 486 | |
| 487 | /* |
| 488 | * Return the index of a given leaf in the c_leaf[] array, where we |
no test coverage detected