MCPcopy Create free account
hub / github.com/DaveGamble/cJSON / cJSON_Minify

Function cJSON_Minify

cJSON.c:2909–2955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2907}
2908
2909CJSON_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
2957CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item)
2958{

Calls 3

skip_oneline_commentFunction · 0.85
skip_multiline_commentFunction · 0.85
minify_stringFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…