diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2024-06-21 07:50:02 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2024-06-21 07:53:30 +0200 |
commit | 15cd9a3881b030a1a4bddc809f038f86ec27e66d (patch) | |
tree | e10c45f64fcdc6ce49c92150bf854f9089cec98e /src/include/common/jsonapi.h | |
parent | 0b06bf9fa972e2964401622f1bb4c611dbe92bd5 (diff) | |
download | postgresql-15cd9a3881b030a1a4bddc809f038f86ec27e66d.tar.gz postgresql-15cd9a3881b030a1a4bddc809f038f86ec27e66d.zip |
jsonapi: Use const char *
Apply const qualifiers to char * arguments and fields throughout the
jsonapi. This allows the top-level APIs such as
pg_parse_json_incremental() to declare their input argument as const.
It also reduces the number of unconstify() calls.
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://www.postgresql.org/message-id/flat/f732b014-f614-4600-a437-dba5a2c3738b%40eisentraut.org
Diffstat (limited to 'src/include/common/jsonapi.h')
-rw-r--r-- | src/include/common/jsonapi.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/include/common/jsonapi.h b/src/include/common/jsonapi.h index 5d3ae4e09b8..71a491d72dc 100644 --- a/src/include/common/jsonapi.h +++ b/src/include/common/jsonapi.h @@ -88,18 +88,18 @@ typedef struct JsonIncrementalState JsonIncrementalState; #define JSONLEX_FREE_STRVAL (1 << 1) typedef struct JsonLexContext { - char *input; + const char *input; size_t input_length; int input_encoding; - char *token_start; - char *token_terminator; - char *prev_token_terminator; + const char *token_start; + const char *token_terminator; + const char *prev_token_terminator; bool incremental; JsonTokenType token_type; int lex_level; bits32 flags; int line_number; /* line number, starting from 1 */ - char *line_start; /* where that line starts within input */ + const char *line_start; /* where that line starts within input */ JsonParserStack *pstack; JsonIncrementalState *inc_state; StringInfo strval; @@ -157,7 +157,7 @@ extern JsonParseErrorType pg_parse_json(JsonLexContext *lex, extern JsonParseErrorType pg_parse_json_incremental(JsonLexContext *lex, JsonSemAction *sem, - char *json, + const char *json, size_t len, bool is_last); @@ -192,7 +192,7 @@ extern JsonParseErrorType json_count_array_elements(JsonLexContext *lex, * cleanup. */ extern JsonLexContext *makeJsonLexContextCstringLen(JsonLexContext *lex, - char *json, + const char *json, size_t len, int encoding, bool need_escapes); |