Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf00a4f0

Browse files
committed
Automatically count the number of output lines in psql/help.c.
The hard-wired PageOutput arguments in usage() and sibling functionshave been a perennial maintenance gotcha, and there's no reason tothink we'll ever get any better about that. Let's get rid of thosemagic constants by constructing the output in a buffer where we cancount the newlines before calling PageOutput. (Perhaps this ismicroscopically slower; but none of these functions are performancecritical, and anyway we might well be buying back all the cost byavoiding having to pass most of the data through snprintf.c. I couldnot detect any speed difference in a desultory check.) This alsogets rid of the need to assume that platform-specific variations inthe output are insignificant.While at it, make the code shorter and more abstract by inventinghelper macros HELP0() and HELPN() to encapsulate the specificoutput actions being invoked.Discussion:https://postgr.es/m/365160.1654289490@sss.pgh.pa.us
1 parent15b6d21 commitf00a4f0

File tree

2 files changed

+450
-397
lines changed

2 files changed

+450
-397
lines changed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp