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

Function csv_record_leafs

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

* Record the requested set of leaf names. The input should be a set * of leaf names, separated by periods. */

Source from the content-addressed store, hash-verified

572 * of leaf names, separated by periods.
573 */
574static int
575csv_record_leafs (xo_handle_t *xop, csv_private_t *csv, const char *leafs_raw)
576{
577 char *cp, *ep, *np;
578 ssize_t len = strlen(leafs_raw);
579 char *leafs_buf = alloca(len + 1);
580
581 memcpy(leafs_buf, leafs_raw, len + 1); /* Make local copy */
582
583 for (cp = leafs_buf, ep = leafs_buf + len; cp && cp < ep; cp = np) {
584 np = strchr(cp, '.');
585 if (np)
586 *np++ = '\0';
587
588 if (*cp == '\0') /* Skip empty names */
589 continue;
590
591 csv_dbg(xop, csv, "adding leaf: [%s]\n", cp);
592 csv_leaf_num(xop, csv, cp, 0);
593 }
594
595 /*
596 * Since we've been told explicitly what leafs matter, ignore the rest
597 */
598 csv->c_flags |= CF_LEAFS_DONE;
599
600 return 0;
601}
602
603/*
604 * Record the requested path elements. The input should be a set of

Callers 1

csv_optionsFunction · 0.85

Calls 4

strchrFunction · 0.85
csv_dbgFunction · 0.85
csv_leaf_numFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected