1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-09-01 12:56:32 +00:00

Support json param type.

This commit is contained in:
Shuai Lin
2016-06-28 12:00:44 +08:00
parent 5fd3bb7176
commit 53a1663d0d
5 changed files with 58 additions and 4 deletions

View File

@@ -57,3 +57,18 @@ inline static json_int_t json_array_get_int_element (json_t *array, size_t index
{
return json_integer_value (json_array_get (array, index));
}
inline static const json_t *json_array_get_json_or_null_element (json_t *array, size_t index)
{
return json_array_get (array, index);
}
inline static void json_array_add_json_or_null_element (json_t *array, const json_t *value)
{
if (value) {
json_t *obj = json_deep_copy(value);
json_array_append_new (array, obj);
} else {
json_array_append_new (array, json_null ());
}
}