Move some pg_dump function around.
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Move some pg_dump function around. Move functions used only by pg_dump and pg_restore from dumputils.c to a new file, pg_backup_utils.c. dumputils.c is linked into psql and some programs in bin/scripts, so it seems good to keep it slim. The parallel functionality is moved to parallel.c, as is exit_horribly, because the interesting code in exit_horribly is parallel-related. This refactoring gets rid of the on_exit_msg_func function pointer. It was problematic, because a modern gcc version with -Wmissing-format-attribute complained if it wasn't marked with PF_PRINTF_ATTRIBUTE, but the ancient gcc version that Tom Lane's old HP-UX box has didn't accept that attribute on a function pointer, and gave an error. We still use a similar function pointer trick for getLocalPQBuffer() function, to use a thread-local version of that in parallel mode on Windows, but that dodges the problem because it doesn't take printf-like arguments.
Files
| Path | Change | +/− |
|---|---|---|
| src/bin/pg_dump/common.c | modified | +1 −0 |
| src/bin/pg_dump/compress_io.c | modified | +1 −1 |
| src/bin/pg_dump/dumputils.c | modified | +14 −194 |
| src/bin/pg_dump/dumputils.h | modified | +1 −25 |
| src/bin/pg_dump/Makefile | modified | +2 −2 |
| src/bin/pg_dump/parallel.c | modified | +118 −18 |
| src/bin/pg_dump/parallel.h | modified | +16 −0 |
| src/bin/pg_dump/pg_backup_archiver.c | modified | +1 −1 |
| src/bin/pg_dump/pg_backup_custom.c | modified | +1 −1 |
| src/bin/pg_dump/pg_backup_db.c | modified | +2 −0 |
| src/bin/pg_dump/pg_backup_directory.c | modified | +1 −1 |
| src/bin/pg_dump/pg_backup_null.c | modified | +2 −1 |
| src/bin/pg_dump/pg_backup_tar.c | modified | +2 −1 |
| src/bin/pg_dump/pg_backup_utils.c | added | +126 −0 |
| src/bin/pg_dump/pg_backup_utils.h | added | +40 −0 |
| src/bin/pg_dump/pg_dumpall.c | modified | +2 −0 |
| src/bin/pg_dump/pg_dump.c | modified | +2 −0 |
| src/bin/pg_dump/pg_dump_sort.c | modified | +2 −1 |
| src/bin/pg_dump/pg_restore.c | modified | +2 −1 |