* makeJsonLexContextCstringLen * * lex constructor, with or without StringInfo object for de-escaped lexemes. * * Without is better as it makes the processing faster, so only make one * if really required. */
| 152 | * if really required. |
| 153 | */ |
| 154 | JsonLexContext * |
| 155 | makeJsonLexContextCstringLen(char *json, int len, int encoding, bool need_escapes) |
| 156 | { |
| 157 | JsonLexContext *lex = palloc0(sizeof(JsonLexContext)); |
| 158 | |
| 159 | lex->input = lex->token_terminator = lex->line_start = json; |
| 160 | lex->line_number = 1; |
| 161 | lex->input_length = len; |
| 162 | lex->input_encoding = encoding; |
| 163 | if (need_escapes) |
| 164 | lex->strval = makeStringInfo(); |
| 165 | return lex; |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | * pg_parse_json |
no test coverage detected