MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / cJSON_AddItemToObjectCS

Function cJSON_AddItemToObjectCS

lib/cJSON.c:1923–1943  ·  view source on GitHub ↗

Add an item to an object with constant string as key */

Source from the content-addressed store, hash-verified

1921
1922/* Add an item to an object with constant string as key */
1923void cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item)
1924{
1925 if (!item)
1926 {
1927 return;
1928 }
1929 if (!(item->type & cJSON_StringIsConst) && item->string)
1930 {
1931 cJSON_free(item->string);
1932 }
1933#if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4)
1934_Pragma("GCC diagnostic push")
1935_Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
1936 item->string = (char*)string;
1937_Pragma("GCC diagnostic pop")
1938#else
1939 item->string = (char*)string;
1940#endif
1941 item->type |= cJSON_StringIsConst;
1942 cJSON_AddItemToArray(object, item);
1943}
1944
1945void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item)
1946{

Callers 2

build_pport_hdr_jsonFunction · 0.85
build_pport_payload_jsonFunction · 0.85

Calls 1

cJSON_AddItemToArrayFunction · 0.70

Tested by

no test coverage detected