diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-08-25 20:46:58 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-08-25 20:48:20 +0200 |
commit | c742eb36b1eb516166cdcb307a37dded51fa6089 (patch) | |
tree | 02d9ca0699c93f20d356fe0fbc78ff1b72a10d0d /src | |
parent | 01b23daa9bab9648457935e0c24376637eecd2e4 (diff) |
libpq code should use libpq_gettext(), not _()
Fix some wrong use and install a safeguard against future mistakes.
Diffstat (limited to 'src')
-rw-r--r-- | src/interfaces/libpq/fe-auth-scram.c | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-int.h | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-auth-scram.c b/src/interfaces/libpq/fe-auth-scram.c index e5ad13daa50..6ee51d4e5e7 100644 --- a/src/interfaces/libpq/fe-auth-scram.c +++ b/src/interfaces/libpq/fe-auth-scram.c @@ -931,7 +931,7 @@ pg_fe_scram_build_secret(const char *password, const char **errstr) rc = pg_saslprep(password, &prep_password); if (rc == SASLPREP_OOM) { - *errstr = _("out of memory"); + *errstr = libpq_gettext("out of memory"); return NULL; } if (rc == SASLPREP_SUCCESS) @@ -940,7 +940,7 @@ pg_fe_scram_build_secret(const char *password, const char **errstr) /* Generate a random salt */ if (!pg_strong_random(saltbuf, SCRAM_DEFAULT_SALT_LEN)) { - *errstr = _("could not generate random salt"); + *errstr = libpq_gettext("could not generate random salt"); if (prep_password) free(prep_password); return NULL; diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 51ab51f9f92..a27dd3785e1 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -880,6 +880,11 @@ extern char *libpq_ngettext(const char *msgid, const char *msgid_plural, unsigne #define libpq_gettext(x) (x) #define libpq_ngettext(s, p, n) ((n) == 1 ? (s) : (p)) #endif +/* + * libpq code should use the above, not _(), since that would use the + * surrounding programs's message catalog. + */ +#undef _ /* * These macros are needed to let error-handling code be portable between |