Skip to content

Commit 3ddbac3

Browse files
committed
Add missing gettext triggers
Commit d660701 moved all the jsonapi.c error messages into token_error(). This needs to be added to the various nls.mk files that use this. Since that makes token_error() effectively a globally known symbol, the name seems a bit too general, so rename to json_token_error() for more clarity.
1 parent 9eb54a2 commit 3ddbac3

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

src/backend/nls.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS) \
1414
syncrep_yyerror \
1515
report_invalid_record:2 \
1616
ereport_startup_progress \
17+
json_token_error:2 \
1718
json_manifest_parse_failure:2 \
1819
error_cb:2
1920
GETTEXT_FLAGS = $(BACKEND_COMMON_GETTEXT_FLAGS) \
@@ -23,6 +24,7 @@ GETTEXT_FLAGS = $(BACKEND_COMMON_GETTEXT_FLAGS) \
2324
write_stderr:1:c-format \
2425
report_invalid_record:2:c-format \
2526
ereport_startup_progress:1:c-format \
27+
json_token_error:2:c-format \
2628
error_cb:2:c-format
2729

2830
gettext-files: generated-parser-sources generated-headers

src/bin/pg_combinebackup/nls.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ GETTEXT_FILES = $(FRONTEND_COMMON_GETTEXT_FILES) \
1111
../../common/jsonapi.c \
1212
../../common/parse_manifest.c
1313
GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS) \
14+
json_token_error:2 \
1415
json_manifest_parse_failure:2 \
1516
error_cb:2
1617
GETTEXT_FLAGS = $(FRONTEND_COMMON_GETTEXT_FLAGS) \
18+
json_token_error:2:c-format \
1719
error_cb:2:c-format

src/bin/pg_verifybackup/nls.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ GETTEXT_FILES = $(FRONTEND_COMMON_GETTEXT_FILES) \
66
../../common/jsonapi.c \
77
../../common/parse_manifest.c
88
GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS) \
9+
json_token_error:2 \
910
json_manifest_parse_failure:2 \
1011
error_cb:2 \
1112
report_backup_error:2 \
1213
report_fatal_error
1314
GETTEXT_FLAGS = $(FRONTEND_COMMON_GETTEXT_FLAGS) \
15+
json_token_error:2:c-format \
1416
error_cb:2:c-format \
1517
report_backup_error:2:c-format \
1618
report_fatal_error:1:c-format

src/common/jsonapi.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,7 +2105,7 @@ json_errdetail(JsonParseErrorType error, JsonLexContext *lex)
21052105
* A helper for error messages that should print the current token. The
21062106
* format must contain exactly one %.*s specifier.
21072107
*/
2108-
#define token_error(lex, format) \
2108+
#define json_token_error(lex, format) \
21092109
appendStringInfo((lex)->errormsg, _(format), \
21102110
(int) ((lex)->token_terminator - (lex)->token_start), \
21112111
(lex)->token_start);
@@ -2124,41 +2124,41 @@ json_errdetail(JsonParseErrorType error, JsonLexContext *lex)
21242124
case JSON_NESTING_TOO_DEEP:
21252125
return (_("JSON nested too deep, maximum permitted depth is 6400"));
21262126
case JSON_ESCAPING_INVALID:
2127-
token_error(lex, "Escape sequence \"\\%.*s\" is invalid.");
2127+
json_token_error(lex, "Escape sequence \"\\%.*s\" is invalid.");
21282128
break;
21292129
case JSON_ESCAPING_REQUIRED:
21302130
appendStringInfo(lex->errormsg,
21312131
_("Character with value 0x%02x must be escaped."),
21322132
(unsigned char) *(lex->token_terminator));
21332133
break;
21342134
case JSON_EXPECTED_END:
2135-
token_error(lex, "Expected end of input, but found \"%.*s\".");
2135+
json_token_error(lex, "Expected end of input, but found \"%.*s\".");
21362136
break;
21372137
case JSON_EXPECTED_ARRAY_FIRST:
2138-
token_error(lex, "Expected array element or \"]\", but found \"%.*s\".");
2138+
json_token_error(lex, "Expected array element or \"]\", but found \"%.*s\".");
21392139
break;
21402140
case JSON_EXPECTED_ARRAY_NEXT:
2141-
token_error(lex, "Expected \",\" or \"]\", but found \"%.*s\".");
2141+
json_token_error(lex, "Expected \",\" or \"]\", but found \"%.*s\".");
21422142
break;
21432143
case JSON_EXPECTED_COLON:
2144-
token_error(lex, "Expected \":\", but found \"%.*s\".");
2144+
json_token_error(lex, "Expected \":\", but found \"%.*s\".");
21452145
break;
21462146
case JSON_EXPECTED_JSON:
2147-
token_error(lex, "Expected JSON value, but found \"%.*s\".");
2147+
json_token_error(lex, "Expected JSON value, but found \"%.*s\".");
21482148
break;
21492149
case JSON_EXPECTED_MORE:
21502150
return _("The input string ended unexpectedly.");
21512151
case JSON_EXPECTED_OBJECT_FIRST:
2152-
token_error(lex, "Expected string or \"}\", but found \"%.*s\".");
2152+
json_token_error(lex, "Expected string or \"}\", but found \"%.*s\".");
21532153
break;
21542154
case JSON_EXPECTED_OBJECT_NEXT:
2155-
token_error(lex, "Expected \",\" or \"}\", but found \"%.*s\".");
2155+
json_token_error(lex, "Expected \",\" or \"}\", but found \"%.*s\".");
21562156
break;
21572157
case JSON_EXPECTED_STRING:
2158-
token_error(lex, "Expected string, but found \"%.*s\".");
2158+
json_token_error(lex, "Expected string, but found \"%.*s\".");
21592159
break;
21602160
case JSON_INVALID_TOKEN:
2161-
token_error(lex, "Token \"%.*s\" is invalid.");
2161+
json_token_error(lex, "Token \"%.*s\" is invalid.");
21622162
break;
21632163
case JSON_UNICODE_CODE_POINT_ZERO:
21642164
return _("\\u0000 cannot be converted to text.");
@@ -2189,7 +2189,7 @@ json_errdetail(JsonParseErrorType error, JsonLexContext *lex)
21892189
/* fall through to the error code after switch */
21902190
break;
21912191
}
2192-
#undef token_error
2192+
#undef json_token_error
21932193

21942194
/*
21952195
* We don't use a default: case, so that the compiler will warn about

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy