1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-17 01:12:23 +02:00

JSON improvements.

Optimize the parser implementation and make the renderer more null tolerant.

Also make some string and variant constructors null tolerant.
This commit is contained in:
David Steele
2019-02-05 15:34:18 +02:00
parent b3d1a2a802
commit be8f31a952
12 changed files with 333 additions and 328 deletions

View File

@ -41,7 +41,7 @@ struct ProtocolClient
};
/***********************************************************************************************************************************
Create a new storage file
Create object
***********************************************************************************************************************************/
ProtocolClient *
protocolClientNew(const String *name, const String *service, IoRead *read, IoWrite *write)
@ -74,7 +74,7 @@ protocolClientNew(const String *name, const String *service, IoRead *read, IoWri
MEM_CONTEXT_TEMP_BEGIN()
{
String *greeting = ioReadLine(this->read);
KeyValue *greetingKv = jsonToKv(greeting);
KeyValue *greetingKv = varKv(jsonToVar(greeting));
const String *expected[] =
{
@ -136,7 +136,7 @@ protocolClientReadOutput(ProtocolClient *this, bool outputRequired)
{
// Read the response
String *response = ioReadLine(this->read);
KeyValue *responseKv = jsonToKv(response);
KeyValue *responseKv = varKv(jsonToVar(response));
// Process error if any
const Variant *error = kvGet(responseKv, varNewStr(PROTOCOL_ERROR_STR));