| 2907 | } |
| 2908 | |
| 2909 | CJSON_PUBLIC(void) cJSON_Minify(char *json) |
| 2910 | { |
| 2911 | char *into = json; |
| 2912 | |
| 2913 | if (json == NULL) |
| 2914 | { |
| 2915 | return; |
| 2916 | } |
| 2917 | |
| 2918 | while (json[0] != '\0') |
| 2919 | { |
| 2920 | switch (json[0]) |
| 2921 | { |
| 2922 | case ' ': |
| 2923 | case '\t': |
| 2924 | case '\r': |
| 2925 | case '\n': |
| 2926 | json++; |
| 2927 | break; |
| 2928 | |
| 2929 | case '/': |
| 2930 | if (json[1] == '/') |
| 2931 | { |
| 2932 | skip_oneline_comment(&json); |
| 2933 | } |
| 2934 | else if (json[1] == '*') |
| 2935 | { |
| 2936 | skip_multiline_comment(&json); |
| 2937 | } else { |
| 2938 | json++; |
| 2939 | } |
| 2940 | break; |
| 2941 | |
| 2942 | case '\"': |
| 2943 | minify_string(&json, (char**)&into); |
| 2944 | break; |
| 2945 | |
| 2946 | default: |
| 2947 | into[0] = json[0]; |
| 2948 | json++; |
| 2949 | into++; |
| 2950 | } |
| 2951 | } |
| 2952 | |
| 2953 | /* and null-terminate. */ |
| 2954 | *into = '\0'; |
| 2955 | } |
| 2956 | |
| 2957 | CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item) |
| 2958 | { |
searching dependent graphs…