1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00
falk-werner_webfuse/lib/webfuse/impl/util/json_util.c

29 lines
544 B
C

#include "webfuse/impl/util/json_util.h"
#include "webfuse/impl/jsonrpc/error.h"
int wf_impl_json_get_int(json_t const * object, char const * key, int default_value)
{
int result = default_value;
json_t * holder = json_object_get(object, key);
if (json_is_integer(holder))
{
result = json_integer_value(holder);
}
return result;
}
wf_status
wf_impl_jsonrpc_get_status(
struct wf_jsonrpc_error const * error)
{
wf_status status = WF_GOOD;
if (NULL != error)
{
status = wf_impl_jsonrpc_error_code(error);
}
return status;
}