MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / cJSON_Minify

Function cJSON_Minify

lib/cJSON.c:2479–2541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2477}
2478
2479void cJSON_Minify(char *json)
2480{
2481 unsigned char *into = (unsigned char*)json;
2482 while (*json)
2483 {
2484 if (*json == ' ')
2485 {
2486 json++;
2487 }
2488 else if (*json == '\t')
2489 {
2490 /* Whitespace characters. */
2491 json++;
2492 }
2493 else if (*json == '\r')
2494 {
2495 json++;
2496 }
2497 else if (*json=='\n')
2498 {
2499 json++;
2500 }
2501 else if ((*json == '/') && (json[1] == '/'))
2502 {
2503 /* double-slash comments, to end of line. */
2504 while (*json && (*json != '\n'))
2505 {
2506 json++;
2507 }
2508 }
2509 else if ((*json == '/') && (json[1] == '*'))
2510 {
2511 /* multiline comments. */
2512 while (*json && !((*json == '*') && (json[1] == '/')))
2513 {
2514 json++;
2515 }
2516 json += 2;
2517 }
2518 else if (*json == '\"')
2519 {
2520 /* string literals, which are \" sensitive. */
2521 *into++ = (unsigned char)*json++;
2522 while (*json && (*json != '\"'))
2523 {
2524 if (*json == '\\')
2525 {
2526 *into++ = (unsigned char)*json++;
2527 }
2528 *into++ = (unsigned char)*json++;
2529 }
2530 *into++ = (unsigned char)*json++;
2531 }
2532 else
2533 {
2534 /* All other characters. */
2535 *into++ = (unsigned char)*json++;
2536 }

Callers 4

w_sip_to_jsonFunction · 0.85
w_merge_jsonFunction · 0.85
janus_raise_eventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected