aboutsummaryrefslogtreecommitdiff
path: root/src/include/common/jsonapi.h
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2024-06-21 07:50:02 +0200
committerPeter Eisentraut <peter@eisentraut.org>2024-06-21 07:53:30 +0200
commit0b06bf9fa972e2964401622f1bb4c611dbe92bd5 (patch)
tree9ad5f17e338e22d13219a5a9e970801ac646c6cc /src/include/common/jsonapi.h
parent7a089f6e6a14ca3a5dc8822c393c6620279968b9 (diff)
downloadpostgresql-0b06bf9fa972e2964401622f1bb4c611dbe92bd5.tar.gz
postgresql-0b06bf9fa972e2964401622f1bb4c611dbe92bd5.zip
jsonapi: Use size_t
Use size_t instead of int for object sizes in the jsonapi. This makes the API better self-documenting. 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.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/common/jsonapi.h b/src/include/common/jsonapi.h
index f1ab17fc9f2..5d3ae4e09b8 100644
--- a/src/include/common/jsonapi.h
+++ b/src/include/common/jsonapi.h
@@ -89,7 +89,7 @@ typedef struct JsonIncrementalState JsonIncrementalState;
typedef struct JsonLexContext
{
char *input;
- int input_length;
+ size_t input_length;
int input_encoding;
char *token_start;
char *token_terminator;
@@ -158,7 +158,7 @@ extern JsonParseErrorType pg_parse_json(JsonLexContext *lex,
extern JsonParseErrorType pg_parse_json_incremental(JsonLexContext *lex,
JsonSemAction *sem,
char *json,
- int len,
+ size_t len,
bool is_last);
/* the null action object used for pure validation */
@@ -193,7 +193,7 @@ extern JsonParseErrorType json_count_array_elements(JsonLexContext *lex,
*/
extern JsonLexContext *makeJsonLexContextCstringLen(JsonLexContext *lex,
char *json,
- int len,
+ size_t len,
int encoding,
bool need_escapes);
@@ -219,6 +219,6 @@ extern char *json_errdetail(JsonParseErrorType error, JsonLexContext *lex);
*
* str argument does not need to be nul-terminated.
*/
-extern bool IsValidJsonNumber(const char *str, int len);
+extern bool IsValidJsonNumber(const char *str, size_t len);
#endif /* JSONAPI_H */