Skip to content

Commit 4be6a74

Browse files
committed
pg_dump: Tiny header cleanup
In commits 9c02e3a and 8ec0aae, Nathan added a duplicate TocEntry typedef forward declaration (plus assorted #ifdef hackery to avoid C99 preprocessor issues) to deal with some very old untidyness regarding DefnDumperPtr function prototype being located in pg_backup.h. But there's no reason to have the DefnDumperPtr typedef (and the accompanying DataDumperPtr typedef) in that file at all; they are better placed in pg_backup_archiver.h, the internal header, because they are only used internally. That also requires zero #ifdef hackery, so move them there. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/202504042140.qo66ggw6wzsz@alvherre.pgsql
1 parent f0d0083 commit 4be6a74

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/bin/pg_dump/pg_backup.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,6 @@ typedef int DumpId;
284284
/*
285285
* Function pointer prototypes for assorted callback methods.
286286
*/
287-
288-
/* forward declaration to avoid including pg_backup_archiver.h here */
289-
#ifndef HAVE_TOCENTRY_TYPEDEF
290-
typedef struct _tocEntry TocEntry;
291-
#define HAVE_TOCENTRY_TYPEDEF 1
292-
#endif
293-
294-
typedef char *(*DefnDumperPtr) (Archive *AH, const void *userArg, const TocEntry *te);
295-
typedef int (*DataDumperPtr) (Archive *AH, const void *userArg);
296-
297287
typedef void (*SetupWorkerPtrType) (Archive *AH);
298288

299289
/*

src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@
9797
#define WORKER_IGNORED_ERRORS 12
9898

9999
typedef struct _archiveHandle ArchiveHandle;
100-
#ifndef HAVE_TOCENTRY_TYPEDEF
101100
typedef struct _tocEntry TocEntry;
102-
#define HAVE_TOCENTRY_TYPEDEF 1
103-
#endif
104101
struct ParallelState;
105102

106103
#define READ_ERROR_EXIT(fd) \
@@ -344,6 +341,10 @@ struct _archiveHandle
344341
struct _tocEntry *lastErrorTE;
345342
};
346343

344+
345+
typedef char *(*DefnDumperPtr) (Archive *AH, const void *userArg, const TocEntry *te);
346+
typedef int (*DataDumperPtr) (Archive *AH, const void *userArg);
347+
347348
struct _tocEntry
348349
{
349350
struct _tocEntry *prev;

0 commit comments

Comments
 (0)