MCPcopy Index your code
hub / github.com/DaveGamble/cJSON / cJSON_CreateNumber

Function cJSON_CreateNumber

cJSON.c:2490–2514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2488}
2489
2490CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num)
2491{
2492 cJSON *item = cJSON_New_Item(&global_hooks);
2493 if(item)
2494 {
2495 item->type = cJSON_Number;
2496 item->valuedouble = num;
2497
2498 /* use saturation in case of overflow */
2499 if (num >= INT_MAX)
2500 {
2501 item->valueint = INT_MAX;
2502 }
2503 else if (num <= (double)INT_MIN)
2504 {
2505 item->valueint = INT_MIN;
2506 }
2507 else
2508 {
2509 item->valueint = (int)num;
2510 }
2511 }
2512
2513 return item;
2514}
2515
2516CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
2517{

Calls 1

cJSON_New_ItemFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…