MCPcopy Create free account
hub / github.com/F-Stack/f-stack / csv_close_level

Function csv_close_level

tools/libxo/encoder/csv/enc_csv.c:462–485  ·  view source on GitHub ↗

* Close a "level", either a container or an instance. */

Source from the content-addressed store, hash-verified

460 * Close a "level", either a container or an instance.
461 */
462static int
463csv_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

Callers 1

csv_handlerFunction · 0.85

Calls 5

csv_emit_recordFunction · 0.85
csv_path_topFunction · 0.85
csv_dbgFunction · 0.85
xo_streqFunction · 0.85
csv_stack_popFunction · 0.85

Tested by

no test coverage detected