diff options
author | Robert Haas <rhaas@postgresql.org> | 2020-01-27 11:22:13 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2020-01-27 11:22:13 -0500 |
commit | 73ce2a03f30b52d6bfb26bc28f1e3e1aa1637577 (patch) | |
tree | a6a19f146fb7281f146fec7d413a79032fd1557f /src/include/utils/jsonapi.h | |
parent | 1f3a021730be98b880d94cabbe21de7e4d8136f5 (diff) | |
download | postgresql-73ce2a03f30b52d6bfb26bc28f1e3e1aa1637577.tar.gz postgresql-73ce2a03f30b52d6bfb26bc28f1e3e1aa1637577.zip |
Move some code from jsonapi.c to jsonfuncs.c.
Specifically, move those functions that depend on ereport()
from jsonapi.c to jsonfuncs.c, in preparation for allowing
jsonapi.c to be used from frontend code.
A few cases where elog(ERROR, ...) is used for can't-happen
conditions are left alone; we can handle those in some other
way in frontend code.
Reviewed by Mark Dilger and Andrew Dunstan.
Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com
Diffstat (limited to 'src/include/utils/jsonapi.h')
-rw-r--r-- | src/include/utils/jsonapi.h | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/include/utils/jsonapi.h b/src/include/utils/jsonapi.h index 74dc35c41c6..4d69b184951 100644 --- a/src/include/utils/jsonapi.h +++ b/src/include/utils/jsonapi.h @@ -126,12 +126,6 @@ typedef struct JsonSemAction extern JsonParseErrorType pg_parse_json(JsonLexContext *lex, JsonSemAction *sem); -/* - * Same thing, but signal errors via ereport(ERROR) instead of returning - * a result code. - */ -extern void pg_parse_json_or_ereport(JsonLexContext *lex, JsonSemAction *sem); - /* the null action object used for pure validation */ extern JsonSemAction nullSemAction; @@ -148,15 +142,11 @@ extern JsonParseErrorType json_count_array_elements(JsonLexContext *lex, int *elements); /* - * constructors for JsonLexContext, with or without strval element. + * constructor for JsonLexContext, with or without strval element. * If supplied, the strval element will contain a de-escaped version of * the lexeme. However, doing this imposes a performance penalty, so * it should be avoided if the de-escaped lexeme is not required. - * - * If you already have the json as a text* value, use the first of these - * functions, otherwise use makeJsonLexContextCstringLen(). */ -extern JsonLexContext *makeJsonLexContext(text *json, bool need_escapes); extern JsonLexContext *makeJsonLexContextCstringLen(char *json, int len, bool need_escapes); @@ -164,9 +154,6 @@ extern JsonLexContext *makeJsonLexContextCstringLen(char *json, /* lex one token */ extern JsonParseErrorType json_lex(JsonLexContext *lex); -/* report an error during json lexing or parsing */ -extern void json_ereport_error(JsonParseErrorType error, JsonLexContext *lex); - /* construct an error detail string for a json error */ extern char *json_errdetail(JsonParseErrorType error, JsonLexContext *lex); |