| 2477 | } |
| 2478 | |
| 2479 | void 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 | } |
no outgoing calls
no test coverage detected