pgsql: Automatically count the number of output lines in psql/help.c.
От | Tom Lane |
---|---|
Тема | pgsql: Automatically count the number of output lines in psql/help.c. |
Дата | |
Msg-id | E1nxW6V-002gq1-KG@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Automatically count the number of output lines in psql/help.c. The hard-wired PageOutput arguments in usage() and sibling functions have been a perennial maintenance gotcha, and there's no reason to think we'll ever get any better about that. Let's get rid of those magic constants by constructing the output in a buffer where we can count the newlines before calling PageOutput. (Perhaps this is microscopically slower; but none of these functions are performance critical, and anyway we might well be buying back all the cost by avoiding having to pass most of the data through snprintf.c. I could not detect any speed difference in a desultory check.) This also gets rid of the need to assume that platform-specific variations in the output are insignificant. While at it, make the code shorter and more abstract by inventing helper macros HELP0() and HELPN() to encapsulate the specific output actions being invoked. Discussion: https://postgr.es/m/365160.1654289490@sss.pgh.pa.us Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f00a4f02ac2e31aaa6f74f8ef916624b9018370f Modified Files -------------- src/bin/psql/help.c | 845 ++++++++++++++++++++++++++++------------------------ src/bin/psql/nls.mk | 2 +- 2 files changed, 450 insertions(+), 397 deletions(-)
В списке pgsql-committers по дате отправления: