MCPcopy Create free account
hub / github.com/OpenIPC/firmware / cJSON_Minify

Function cJSON_Minify

general/package/xmdp/src/cjson/cJSON.c:2815–2861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2813}
2814
2815CJSON_PUBLIC(void) cJSON_Minify(char *json)
2816{
2817 char *into = json;
2818
2819 if (json == NULL)
2820 {
2821 return;
2822 }
2823
2824 while (json[0] != '\0')
2825 {
2826 switch (json[0])
2827 {
2828 case ' ':
2829 case '\t':
2830 case '\r':
2831 case '\n':
2832 json++;
2833 break;
2834
2835 case '/':
2836 if (json[1] == '/')
2837 {
2838 skip_oneline_comment(&json);
2839 }
2840 else if (json[1] == '*')
2841 {
2842 skip_multiline_comment(&json);
2843 } else {
2844 json++;
2845 }
2846 break;
2847
2848 case '\"':
2849 minify_string(&json, (char**)&into);
2850 break;
2851
2852 default:
2853 into[0] = json[0];
2854 json++;
2855 into++;
2856 }
2857 }
2858
2859 /* and null-terminate. */
2860 *into = '\0';
2861}
2862
2863CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item)
2864{

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