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

refactor: renamed json_parse to json_doc

This commit is contained in:
Falk Werner
2020-07-12 15:26:30 +02:00
parent 2979904514
commit bf8ba05863
9 changed files with 42 additions and 53 deletions

View File

@@ -20,7 +20,7 @@
#include "webfuse_provider/impl/jsonrpc/response.h"
#include "webfuse_provider/impl/jsonrpc/request.h"
#include "webfuse_provider/impl/jsonrpc/proxy.h"
#include "webfuse_provider/impl/json/parser.h"
#include "webfuse_provider/impl/json/doc.h"
#define WFP_DEFAULT_TIMEOUT (10 * 1000)
@@ -39,10 +39,10 @@ static void wfp_impl_client_protocol_process(
char * data,
size_t length)
{
struct wfp_json_doc * doc = wfp_impl_json_parse_buffer(data, length);
struct wfp_json_doc * doc = wfp_impl_json_doc_loadb(data, length);
if (NULL != doc)
{
struct wfp_json const * message = wfp_impl_json_root(doc);
struct wfp_json const * message = wfp_impl_json_doc_root(doc);
if (wfp_jsonrpc_is_response(message))
{
wfp_jsonrpc_proxy_onresult(protocol->proxy, message);
@@ -60,7 +60,7 @@ static void wfp_impl_client_protocol_process(
wfp_impl_provider_invoke(&context, message);
}
wfp_impl_json_dispose(doc);
wfp_impl_json_doc_dispose(doc);
}
}

View File

@@ -1,9 +1,8 @@
#include "webfuse_provider/impl/json/parser.h"
#include "webfuse_provider/impl/json/doc.h"
#include "webfuse_provider/impl/json/node_intern.h"
#include "webfuse_provider/impl/json/reader.h"
#include <stdlib.h>
#include <string.h>
#define WFP_IMPL_JSON_DEFAULT_CAPACITY 4
@@ -49,15 +48,9 @@ wfp_impl_json_parse_object(
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(
wfp_impl_json_doc_loadb(
char * data,
size_t length)
{
@@ -75,7 +68,7 @@ wfp_impl_json_parse_buffer(
}
void
wfp_impl_json_dispose(
wfp_impl_json_doc_dispose(
struct wfp_json_doc * doc)
{
wfp_impl_json_cleanup(&doc->root);
@@ -83,7 +76,7 @@ wfp_impl_json_dispose(
}
struct wfp_json const *
wfp_impl_json_root(
wfp_impl_json_doc_root(
struct wfp_json_doc * doc)
{
return &(doc->root);

View File

@@ -1,5 +1,5 @@
#ifndef WFP_IMPL_JSON_PARSER_H
#define WFP_IMPL_JSON_PARSER_H
#ifndef WFP_IMPL_JSON_DOC_H
#define WFP_IMPL_JSON_DOC_H
#ifndef __cplusplus
#include <stddef.h>
@@ -16,20 +16,16 @@ 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(
wfp_impl_json_doc_loadb(
char * data,
size_t length);
extern void
wfp_impl_json_dispose(
wfp_impl_json_doc_dispose(
struct wfp_json_doc * doc);
extern struct wfp_json const *
wfp_impl_json_root(
wfp_impl_json_doc_root(
struct wfp_json_doc * doc);
#ifdef __cplusplus