Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c742eb3

Browse files
committed
libpq code should use libpq_gettext(), not _()
Fix some wrong use and install a safeguard against future mistakes.
1 parent 01b23da commit c742eb3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/interfaces/libpq/fe-auth-scram.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ pg_fe_scram_build_secret(const char *password, const char **errstr)
931931
rc = pg_saslprep(password, &prep_password);
932932
if (rc == SASLPREP_OOM)
933933
{
934-
*errstr = _("out of memory");
934+
*errstr = libpq_gettext("out of memory");
935935
return NULL;
936936
}
937937
if (rc == SASLPREP_SUCCESS)
@@ -940,7 +940,7 @@ pg_fe_scram_build_secret(const char *password, const char **errstr)
940940
/* Generate a random salt */
941941
if (!pg_strong_random(saltbuf, SCRAM_DEFAULT_SALT_LEN))
942942
{
943-
*errstr = _("could not generate random salt");
943+
*errstr = libpq_gettext("could not generate random salt");
944944
if (prep_password)
945945
free(prep_password);
946946
return NULL;

src/interfaces/libpq/libpq-int.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,11 @@ extern char *libpq_ngettext(const char *msgid, const char *msgid_plural, unsigne
880880
#define libpq_gettext(x) (x)
881881
#define libpq_ngettext(s, p, n) ((n) == 1 ? (s) : (p))
882882
#endif
883+
/*
884+
* libpq code should use the above, not _(), since that would use the
885+
* surrounding programs's message catalog.
886+
*/
887+
#undef _
883888

884889
/*
885890
* These macros are needed to let error-handling code be portable between

0 commit comments

Comments
 (0)