Fix some wrong use and install a safeguard against future mistakes.
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)
/* 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");
free(prep_password);
return NULL;
}
#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