Make print_number work for negative numbers again.

Refs #4865
This commit is contained in:
Gunnar Beutner 2014-04-20 19:06:54 +02:00
parent 08cdb3676d
commit 6482fcec59
1 changed files with 1 additions and 1 deletions

View File

@ -127,7 +127,7 @@ static char *print_number(cJSON *item)
}
else
{
str=(char*)cJSON_malloc(64 + (int)log10(d)); /* This is a nice tradeoff. */
str=(char*)cJSON_malloc(64 + (int)log10(fabs(d))); /* This is a nice tradeoff. */
if (str)
{
if (d != d) strcpy(str, "0");