Fix jsonb_from_cstring parameter type for length

Поиск
Список
Период
Сортировка
От Chao Li
Тема Fix jsonb_from_cstring parameter type for length
Дата
Msg-id CAEoWx2n-OWFAWhbVXHiBqHxTOKz71LCoX6EtuJ=z=5pkHFe-Ag@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
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/
Вложения

В списке pgsql-hackers по дате отправления: