MCPcopy Index your code
hub / github.com/IBM/Project_CodeNet / CSV_escape

Function CSV_escape

tools/json-graph/src/jsonml2jgf.c:194–214  ·  view source on GitHub ↗

Escape token for output as CSV string.

Source from the content-addressed store, hash-verified

192
193// Escape token for output as CSV string.
194static void CSV_escape(FILE *fp, jsmntok_t *tok)
195{
196 const char *p = input + tok->start;
197 const char *end = input + tok->end;
198 /* Check whether quotes are needed: */
199 for (; p < end; p++)
200 if (*p == ',' || *p == '"') {
201 // start CSV string:
202 fputc('"', fp);
203 /* reset and quote ": */
204 for (p = input + tok->start; p < end; p++) {
205 if (*p == '"')
206 fputc('"', fp);
207 fputc(*p, fp);
208 }
209 // end CSV string:
210 fputc('"', fp);
211 return;
212 }
213 show(fp, tok, -1);
214}
215
216/* DFS */
217static void show_tokens_aux(Node n, Node p, Node gp, FILE *fp)

Callers 1

show_tokens_auxFunction · 0.70

Calls 1

showFunction · 0.85

Tested by

no test coverage detected