MCPcopy Create free account
hub / github.com/esnet/iperf / JSON_write

Function JSON_write

src/iperf_api.c:2994–3016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2992/*************************************************************/
2993
2994static int
2995JSON_write(int fd, cJSON *json)
2996{
2997 uint32_t hsize, nsize;
2998 char *str;
2999 int r = 0;
3000
3001 str = cJSON_PrintUnformatted(json);
3002 if (str == NULL)
3003 r = -1;
3004 else {
3005 hsize = strlen(str);
3006 nsize = htonl(hsize);
3007 if (Nwrite(fd, (char*) &nsize, sizeof(nsize), Ptcp) < 0)
3008 r = -1;
3009 else {
3010 if (Nwrite(fd, str, hsize, Ptcp) < 0)
3011 r = -1;
3012 }
3013 cJSON_free(str);
3014 }
3015 return r;
3016}
3017
3018/*************************************************************/
3019

Callers 2

send_parametersFunction · 0.85
send_resultsFunction · 0.85

Calls 3

cJSON_PrintUnformattedFunction · 0.85
NwriteFunction · 0.85
cJSON_freeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…