1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2026-03-02 04:09:18 +00:00

refactor: replaced jansson by own json parser implementation

This commit is contained in:
Falk Werner
2020-07-12 00:39:55 +02:00
parent 63ca5d5a6d
commit 63cc5b5388
35 changed files with 443 additions and 423 deletions

View File

@@ -8,35 +8,35 @@ bool
wfp_impl_json_is_bool(
struct wfp_json const * json)
{
return (WFP_JSON_BOOL == json->type);
return ((NULL != json) &&(WFP_JSON_BOOL == json->type));
}
bool
wfp_impl_json_is_int(
struct wfp_json const * json)
{
return (WFP_JSON_INT == json->type);
return ((NULL != json) && (WFP_JSON_INT == json->type));
}
bool
wfp_impl_json_is_string(
struct wfp_json const * json)
{
return (WFP_JSON_STRING == json->type);
return ((NULL != json) && (WFP_JSON_STRING == json->type));
}
bool
wfp_impl_json_is_array(
struct wfp_json const * json)
{
return (WFP_JSON_ARRAY == json->type);
return ((NULL != json) && (WFP_JSON_ARRAY == json->type));
}
bool
wfp_impl_json_is_object(
struct wfp_json const * json)
{
return (WFP_JSON_OBJECT == json->type);
return ((NULL != json) && (WFP_JSON_OBJECT == json->type));
}
bool

View File

@@ -3,6 +3,7 @@
#include "webfuse_provider/impl/json/reader.h"
#include <stdlib.h>
#include <string.h>
#define WFP_IMPL_JSON_DEFAULT_CAPACITY 4
@@ -47,6 +48,14 @@ wfp_impl_json_parse_object(
struct wfp_json_reader * reader,
struct wfp_json * json);
extern struct wfp_json_doc *
wfp_impl_json_parse(
char * data)
{
return wfp_impl_json_parse_buffer(data, strlen(data));
}
struct wfp_json_doc *
wfp_impl_json_parse_buffer(
char * data,

View File

@@ -15,6 +15,10 @@ extern "C"
struct wfp_json;
struct wfp_json_doc;
extern struct wfp_json_doc *
wfp_impl_json_parse(
char * data);
extern struct wfp_json_doc *
wfp_impl_json_parse_buffer(
char * data,