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

Function JSON_escape

tools/tokenizer/pytokenize.c:747–760  ·  view source on GitHub ↗

Escape token for output as JSON string.

Source from the content-addressed store, hash-verified

745
746// Escape token for output as JSON string.
747static void JSON_escape(FILE *out, const char *token)
748{
749 // To preserve, simply escape the escape and all ":
750 const char *p;
751 for (p = token; *p; p++) {
752 if (*p == '\n') {
753 fputs("\\n", out);
754 continue;
755 }
756 if (*p == '\\' || *p == '"')
757 fputc('\\', out);
758 fputc(*p, out);
759 }
760}
761
762// Escape token for output as XML text.
763static void XML_escape(FILE *out, const char *token)

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected