Hi Hackers,

While reading the code of jsonb_from_ctring(char *json, int len, bool ...),
I found that:

1. len should be type of size_t. Because len is only used when calling
makeJsonLexContextCstring(&lex, json, len, ...),
where makeJsonLexContextCstring() is defined with size_t for len.
jsonb_from_cstring() is a local static function, it is called 3 times, 2 of
callers pass size_t len to it, and only one caller passes int len to it.

2. The first parameter "json" can be a const string, as this function
passes "json" to  makeJsonLexContextCstring() and it defines "json" as
const char *.

So I corrected the function interface. Build passed without warning and
"make check" passed as well.

Best regards,
Chao Li (Evan)
---------------------
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment: v1-0001-Make-jsonb_from_cstring-parameters-more-accurate-.patch
Description: Binary data

Reply via email to