Mop up some no-longer-necessary hacks around printf %.*s format.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 29 Jun 2020 21:12:38 +0000 (17:12 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 29 Jun 2020 21:12:38 +0000 (17:12 -0400)
commitc410af098c46949e36607eb13689e697fa2def97
tree98da94dc6bc93b6919ecb5bab1e0fa916575ce47
parentf7a476f0d656bbc673474b9165cd05fa548c18c9
Mop up some no-longer-necessary hacks around printf %.*s format.

Commit 54cd4f045 added some kluges to work around an old glibc bug,
namely that %.*s could misbehave if glibc thought any characters in
the supplied string were incorrectly encoded.  Now that we use our
own snprintf.c implementation, we need not worry about that bug (even
if it still exists in the wild).  Revert a couple of particularly
ugly hacks, and remove or improve assorted comments.

Note that there can still be encoding-related hazards here: blindly
clipping at a fixed length risks producing wrongly-encoded output
if the clip splits a multibyte character.  However, code that's
doing correct multibyte-aware clipping doesn't really need a comment
about that, while code that isn't needs an explanation why not,
rather than a red-herring comment about an obsolete bug.

Discussion: https://postgr.es/m/279428.1593373684@sss.pgh.pa.us
src/backend/commands/copy.c
src/backend/parser/scansup.c
src/backend/tsearch/wparser_def.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/ruleutils.c
src/fe_utils/print.c
src/interfaces/ecpg/ecpglib/error.c
src/interfaces/ecpg/pgtypeslib/dt_common.c
src/interfaces/libpq/fe-misc.c