1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Code + docs review for unicode linestyle patch.

Fix some brain fade in commit a2dabf0e1d: erroneous variable names
in docs, rearrangements that made sentences less clear not more so,
undocumented and poorly-chosen-anyway API behaviors of subroutines,
bad grammar in error messages, copy-and-paste faults.

Albe Laurenz and Tom Lane
This commit is contained in:
Tom Lane
2015-11-03 11:49:21 -05:00
parent 4efe26cbd3
commit a69b0b2c14
3 changed files with 45 additions and 39 deletions

View File

@ -2415,11 +2415,11 @@ _align2string(enum printFormat in)
}
/*
* Parse entered unicode linestyle. Returns true, when entered string is
* known linestyle: single, double else returns false.
* Parse entered unicode linestyle. If ok, update *linestyle and return
* true, else return false.
*/
static bool
set_unicode_line_style(printQueryOpt *popt, const char *value, size_t vallen,
set_unicode_line_style(const char *value, size_t vallen,
unicode_linestyle *linestyle)
{
if (pg_strncasecmp("single", value, vallen) == 0)
@ -2428,10 +2428,6 @@ set_unicode_line_style(printQueryOpt *popt, const char *value, size_t vallen,
*linestyle = UNICODE_LINESTYLE_DOUBLE;
else
return false;
/* input is ok, generate new unicode style */
refresh_utf8format(&(popt->topt));
return true;
}
@ -2517,10 +2513,12 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
{
if (!value)
;
else if (!set_unicode_line_style(popt, value, vallen,
&popt->topt.unicode_border_linestyle))
else if (set_unicode_line_style(value, vallen,
&popt->topt.unicode_border_linestyle))
refresh_utf8format(&(popt->topt));
else
{
psql_error("\\pset: allowed unicode border linestyle are single, double\n");
psql_error("\\pset: allowed unicode border linestyles are single, double\n");
return false;
}
}
@ -2530,10 +2528,12 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
{
if (!value)
;
else if (!set_unicode_line_style(popt, value, vallen,
&popt->topt.unicode_column_linestyle))
else if (set_unicode_line_style(value, vallen,
&popt->topt.unicode_column_linestyle))
refresh_utf8format(&(popt->topt));
else
{
psql_error("\\pset: allowed unicode column linestyle are single, double\n");
psql_error("\\pset: allowed unicode column linestyles are single, double\n");
return false;
}
}
@ -2543,10 +2543,12 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
{
if (!value)
;
else if (!set_unicode_line_style(popt, value, vallen,
&popt->topt.unicode_header_linestyle))
else if (set_unicode_line_style(value, vallen,
&popt->topt.unicode_header_linestyle))
refresh_utf8format(&(popt->topt));
else
{
psql_error("\\pset: allowed unicode header linestyle are single, double\n");
psql_error("\\pset: allowed unicode header linestyles are single, double\n");
return false;
}
}
@ -2871,7 +2873,7 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
else if (strcmp(param, "unicode_header_linestyle") == 0)
{
printf(_("Unicode border linestyle is \"%s\".\n"),
printf(_("Unicode header linestyle is \"%s\".\n"),
_unicode_linestyle2string(popt->topt.unicode_header_linestyle));
}