[winpr,utils] add WINPR_JSON_AddItemToArray
This commit is contained in:
parent
467cf6e346
commit
e34b8b5205
@ -83,6 +83,8 @@ extern "C"
|
||||
WINPR_API WINPR_JSON* WINPR_JSON_AddObjectToObject(WINPR_JSON* object, const char* name);
|
||||
WINPR_API WINPR_JSON* WINPR_JSON_AddArrayToObject(WINPR_JSON* object, const char* name);
|
||||
|
||||
WINPR_API BOOL WINPR_JSON_AddItemToArray(WINPR_JSON* array, WINPR_JSON* item);
|
||||
|
||||
WINPR_API char* WINPR_JSON_Print(WINPR_JSON* item);
|
||||
WINPR_API char* WINPR_JSON_PrintUnformatted(WINPR_JSON* item);
|
||||
|
||||
|
@ -613,6 +613,22 @@ WINPR_JSON* WINPR_JSON_AddObjectToObject(WINPR_JSON* const object, const char* c
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOL WINPR_JSON_AddItemToArray(WINPR_JSON* array, WINPR_JSON* item)
|
||||
{
|
||||
#if defined(WITH_JSONC)
|
||||
const int rc = json_object_array_add((json_object*)array, (json_object*)item);
|
||||
if (rc != 0)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
#elif defined(WITH_CJSON)
|
||||
return cJSON_AddItemToArray((cJSON*)array, (cJSON*)item);
|
||||
#else
|
||||
WINPR_UNUSED(object);
|
||||
WINPR_UNUSED(name);
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
WINPR_JSON* WINPR_JSON_AddArrayToObject(WINPR_JSON* const object, const char* const name)
|
||||
{
|
||||
#if defined(WITH_JSONC)
|
||||
|
Loading…
Reference in New Issue
Block a user