diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-06-29 17:12:38 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-06-29 17:12:38 -0400 |
commit | c410af098c46949e36607eb13689e697fa2def97 (patch) | |
tree | 98da94dc6bc93b6919ecb5bab1e0fa916575ce47 /src/backend/utils/adt/datetime.c | |
parent | f7a476f0d656bbc673474b9165cd05fa548c18c9 (diff) | |
download | postgresql-c410af098c46949e36607eb13689e697fa2def97.tar.gz postgresql-c410af098c46949e36607eb13689e697fa2def97.zip |
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
Diffstat (limited to 'src/backend/utils/adt/datetime.c')
-rw-r--r-- | src/backend/utils/adt/datetime.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 0b6dfb248cb..dec2fad82a6 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -4013,7 +4013,8 @@ EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char /* * Note: the uses of %.*s in this function would be risky if the - * timezone names ever contain non-ASCII characters. However, all + * timezone names ever contain non-ASCII characters, since we are + * not being careful to do encoding-aware clipping. However, all * TZ abbreviations in the IANA database are plain ASCII. */ if (print_tz) |