MCPcopy Create free account
hub / github.com/antirez/botlib / cJSON_Minify

Function cJSON_Minify

cJSON.c:2829–2875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2827}
2828
2829CJSON_PUBLIC(void) cJSON_Minify(char *json)
2830{
2831 char *into = json;
2832
2833 if (json == NULL)
2834 {
2835 return;
2836 }
2837
2838 while (json[0] != '\0')
2839 {
2840 switch (json[0])
2841 {
2842 case ' ':
2843 case '\t':
2844 case '\r':
2845 case '\n':
2846 json++;
2847 break;
2848
2849 case '/':
2850 if (json[1] == '/')
2851 {
2852 skip_oneline_comment(&json);
2853 }
2854 else if (json[1] == '*')
2855 {
2856 skip_multiline_comment(&json);
2857 } else {
2858 json++;
2859 }
2860 break;
2861
2862 case '\"':
2863 minify_string(&json, (char**)&into);
2864 break;
2865
2866 default:
2867 into[0] = json[0];
2868 json++;
2869 into++;
2870 }
2871 }
2872
2873 /* and null-terminate. */
2874 *into = '\0';
2875}
2876
2877CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item)
2878{

Callers

nothing calls this directly

Calls 3

skip_oneline_commentFunction · 0.85
skip_multiline_commentFunction · 0.85
minify_stringFunction · 0.85

Tested by

no test coverage detected