MCPcopy Index your code
hub / github.com/esnet/iperf / cJSON_CreateNumber

Function cJSON_CreateNumber

src/cjson.c:2440–2464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2438}
2439
2440CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num)
2441{
2442 cJSON *item = cJSON_New_Item(&global_hooks);
2443 if(item)
2444 {
2445 item->type = cJSON_Number;
2446 item->valuedouble = num;
2447
2448 /* use saturation in case of overflow */
2449 if (num >= LLONG_MAX)
2450 {
2451 item->valueint = LLONG_MAX;
2452 }
2453 else if (num <= (double)LLONG_MIN)
2454 {
2455 item->valueint = LLONG_MIN;
2456 }
2457 else
2458 {
2459 item->valueint = (int64_t)num;
2460 }
2461 }
2462
2463 return item;
2464}
2465
2466CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
2467{

Callers 5

iperf_json_printfFunction · 0.85
cJSON_AddNumberToObjectFunction · 0.85
cJSON_CreateIntArrayFunction · 0.85
cJSON_CreateFloatArrayFunction · 0.85
cJSON_CreateDoubleArrayFunction · 0.85

Calls 1

cJSON_New_ItemFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…