postgresql/src/bin/initdb
Tom Lane e0f05cd5ba Improve some ancient, crufty code in bootstrap + initdb.
At some point back in the last century, somebody felt that reading
all of pg_type twice was cheaper, or at least easier, than using
repalloc() to resize the Typ[] array dynamically.  That seems like an
entirely wacko proposition, so rewrite the code to do it the other
way.  (To add insult to injury, there were two not-quite-identical
copies of said code.)

initdb.c's readfile() function had the same disease of preferring
to do double the I/O to avoid resizing its output array.  Here,
we can make things easier by using the just-invented pg_get_line()
function to handle reading individual lines without a predetermined
notion of how long they are.

On my machine, it's difficult to detect any net change in the
overall runtime of initdb from these changes; but they should
help on slower buildfarm machines (especially since a buildfarm
cycle involves a lot of initdb's these days).

My attention was drawn to these places by scan-build complaints,
but on inspection they needed a lot more work than just suppressing
dead stores :-(
2020-09-05 16:20:04 -04:00
..
po Translation updates 2020-05-18 12:49:30 +02:00
t Initial pgperltidy run for v12. 2019-05-22 13:36:19 -04:00
.gitignore Move wchar.c and encnames.c to src/common/. 2020-01-16 15:58:55 -05:00
findtimezone.c Update Windows timezone name list to include currently-known zones. 2020-04-24 17:53:23 -04:00
initdb.c Improve some ancient, crufty code in bootstrap + initdb. 2020-09-05 16:20:04 -04:00
Makefile Move wchar.c and encnames.c to src/common/. 2020-01-16 15:58:55 -05:00
nls.mk Translation updates 2020-05-11 13:14:32 +02:00