{"action":"created","issue":{"url":"https://api.github.com/repos/DaveGamble/cJSON/issues/24","repository_url":"https://api.github.com/repos/DaveGamble/cJSON","labels_url":"https://api.github.com/repos/DaveGamble/cJSON/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/DaveGamble/cJSON/issues/24/comments","events_url":"https://api.github.com/repos/DaveGamble/cJSON/issues/24/events","html_url":"https://github.com/DaveGamble/cJSON/issues/24","id":176255809,"number":24,"title":"Make source code readable","user":{"login":"FSMaxB","id":4294942,"avatar_url":"https://avatars.githubusercontent.com/u/4294942?v=3","gravatar_id":"","url":"https://api.github.com/users/FSMaxB","html_url":"https://github.com/FSMaxB","followers_url":"https://api.github.com/users/FSMaxB/followers","following_url":"https://api.github.com/users/FSMaxB/following{/other_user}","gists_url":"https://api.github.com/users/FSMaxB/gists{/gist_id}","starred_url":"https://api.github.com/users/FSMaxB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FSMaxB/subscriptions","organizations_url":"https://api.github.com/users/FSMaxB/orgs","repos_url":"https://api.github.com/users/FSMaxB/repos","events_url":"https://api.github.com/users/FSMaxB/events{/privacy}","received_events_url":"https://api.github.com/users/FSMaxB/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-09-11T17:56:17Z","updated_at":"2016-09-13T00:44:10Z","closed_at":null,"body":"Let's face it, cJSON's source code is looking quite horrible in the current form. The way it is it's bad for potential contributors because it is hard to read and it also makes tracking changes with git harder.\r\n\r\nI would volunteer to reformat the code if you let me. I will follow the format you like, but here's a suggestion:\r\n\r\nCurrently:\r\n```c\r\n/* Parse the input text to generate a number, and populate the result into item. */\r\nstatic const char *parse_number(cJSON *item,const char *num)\r\n{\r\n\tdouble n=0,sign=1,scale=0;int subscale=0,signsubscale=1;\r\n\r\n\tif (*num=='-') sign=-1,num++;\t/* Has sign? */\r\n\tif (*num=='0') num++;\t\t\t/* is zero */\r\n\tif (*num>='1' && *num<='9')\tdo\tn=(n*10.0)+(*num++ -'0');\twhile (*num>='0' && *num<='9');\t/* Number? */\r\n\tif (*num=='.' && num[1]>='0' && num[1]<='9') {num++;\t\tdo\tn=(n*10.0)+(*num++ -'0'),scale--; while (*num>='0' && *num<='9');}\t/* Fractional part? */\r\n\tif (*num=='e' || *num=='E')\t\t/* Exponent? */\r\n\t{\tnum++;if (*num=='+') num++;\telse if (*num=='-') signsubscale=-1,num++;\t\t/* With sign? */\r\n\t\twhile (*num>='0' && *num<='9') subscale=(subscale*10)+(*num++ - '0');\t/* Number? */\r\n\t}\r\n\r\n\tn=sign*n*pow(10.0,(scale+subscale*signsubscale));\t/* number = +/- number.fraction * 10^+/- exponent */\r\n\t\r\n\titem->valuedouble=n;\r\n\titem->valueint=(int)n;\r\n\titem->type=cJSON_Number;\r\n\treturn num;\r\n}\r\n```\r\n\r\nAfter reformatting:\r\n```c\r\n/* Parse the input text to generate a number, and populate the result into item. */\r\nstatic const char *parse_number(cJSON *item,const char *num) {\r\n\tdouble n = 0;\r\n\tdouble sign = 1;\r\n\tdouble scale = 0;\r\n\tint subscale = 0;\r\n\tint signsubscale = 1;\r\n\r\n\t/* Has sign? */\r\n\tif (*num == '-') {\r\n\t\tsign = -1;\r\n\t\tnum++;\r\n\t}\r\n\r\n\t/* is zero */\r\n\tif (*num == '0') {\r\n\t\tnum++;\r\n\t}\r\n\tif ((*num >= '1') && (*num <= '9')) {\r\n\t\tdo {\r\n\t\t\tn = (n * 10.0) + (*num++ - '0');\r\n\t\t} while ((*num >= '0') && (*num <= '9')); /* Number? */\r\n\t}\r\n\t/* Fractional part? */\r\n\tif ((*num == '.') && (num[1] >= '0') && (num[1] <= '9')) {\r\n\t\tnum++;\r\n\t\tdo {\r\n\t\t\tn = (n * 10.0) + (*num++ - '0');\r\n\t\t\tscale--;\r\n\t\t} while ((*num >= '0') && (*num <= '9'));\r\n\t}\r\n\t/* Exponent? */\r\n\tif ((*num == 'e') || (*num == 'E')) {\r\n\t\tnum++;\r\n\t\t/* With sign? */\r\n\t\tif (*num == '+') {\r\n\t\t\tnum++;\r\n\t\t} else if (*num == '-') {\r\n\t\t\tsignsubscale = -1;\r\n\t\t\tnum++;\r\n\t\t}\r\n\t\twhile ((*num >= '0') && (*num <= '9')) {/* Number? */\r\n\t\t\tsubscale = (subscale * 10) + (*num++ - '0');\r\n\t\t}\r\n\t}\r\n\r\n\t/* number = +/- number.fraction * 10^+/- exponent */\r\n\tn = sign * n * pow(10.0, (scale + subscale * signsubscale));\r\n\r\n\titem->valuedouble = n;\r\n\titem->valueint = (int) n;\r\n\titem->type = cJSON_Number;\r\n\treturn num;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/DaveGamble/cJSON/issues/comments/246539768","html_url":"https://github.com/DaveGamble/cJSON/issues/24#issuecomment-246539768","issue_url":"https://api.github.com/repos/DaveGamble/cJSON/issues/24","id":246539768,"user":{"login":"blakemcbride","id":6467584,"avatar_url":"https://avatars.githubusercontent.com/u/6467584?v=3","gravatar_id":"","url":"https://api.github.com/users/blakemcbride","html_url":"https://github.com/blakemcbride","followers_url":"https://api.github.com/users/blakemcbride/followers","following_url":"https://api.github.com/users/blakemcbride/following{/other_user}","gists_url":"https://api.github.com/users/blakemcbride/gists{/gist_id}","starred_url":"https://api.github.com/users/blakemcbride/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blakemcbride/subscriptions","organizations_url":"https://api.github.com/users/blakemcbride/orgs","repos_url":"https://api.github.com/users/blakemcbride/repos","events_url":"https://api.github.com/users/blakemcbride/events{/privacy}","received_events_url":"https://api.github.com/users/blakemcbride/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T00:44:09Z","updated_at":"2016-09-13T00:44:09Z","body":"On Mon, Sep 12, 2016 at 6:57 PM, Dave Gamble <notifications@github.com>\nwrote:\n\n> I'm recanting on my position, having had a few more requests. Given that,\n> your reply feels rather uncalled for. It wasn't my intention to ruin your\n> day by not immediately acquiescing to a single request, however reasonable\n> you felt it was.\n>\n> Is there some kind of game in the open source world where you write unkind\n> comments to people volunteering their free time, that I'm not in on?\n>\n\nAdmittedly, I was rude.  I apologize.  I appreciate your work.  At least\none of my contributions took more than two years of much more than 40 hours\nper week.  Followed by many years of enhancements.  It includes a 350 page\nand a 250 page manual.  So, I feel your pain.  (\nhttps://github.com/blakemcbride/Dynace )\n\nBlake\n"}}
{"actor":{"display_login":"blakemcbride"}}