diff options
author | Michael Paquier <michael@paquier.xyz> | 2022-09-27 09:15:07 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2022-09-27 09:15:07 +0900 |
commit | e1e6f8f3dfe141839220875270a81ad3a719e0b6 (patch) | |
tree | d3bed4b143fa09b7499bf5e1eb3fa150b7ceca00 /src/backend/access/transam/xlogbackup.c | |
parent | 31d2c4716e6b429353bb81cebaa0f2b1267823d6 (diff) | |
download | postgresql-e1e6f8f3dfe141839220875270a81ad3a719e0b6.tar.gz postgresql-e1e6f8f3dfe141839220875270a81ad3a719e0b6.zip |
Remove dependency to StringInfo in xlogbackup.{c.h}
This was used as the returned result type of the generated contents for
the backup_label and backup history files. This is replaced by a simple
string, reducing the cleanup burden of all the callers of
build_backup_content().
Reviewed-by: Bharath Rupireddy
Discussion: https://postgr.es/m/YzERvNPaZivHEKZJ@paquier.xyz
Diffstat (limited to 'src/backend/access/transam/xlogbackup.c')
-rw-r--r-- | src/backend/access/transam/xlogbackup.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/access/transam/xlogbackup.c b/src/backend/access/transam/xlogbackup.c index c01c1f90102..90b5273b028 100644 --- a/src/backend/access/transam/xlogbackup.c +++ b/src/backend/access/transam/xlogbackup.c @@ -23,15 +23,16 @@ * When ishistoryfile is true, it creates the contents for a backup history * file, otherwise it creates contents for a backup_label file. * - * Returns the result generated as a palloc'd StringInfo. + * Returns the result generated as a palloc'd string. */ -StringInfo +char * build_backup_content(BackupState *state, bool ishistoryfile) { char startstrbuf[128]; char startxlogfile[MAXFNAMELEN]; /* backup start WAL file */ XLogSegNo startsegno; StringInfo result = makeStringInfo(); + char *data; Assert(state != NULL); @@ -76,5 +77,8 @@ build_backup_content(BackupState *state, bool ishistoryfile) appendStringInfo(result, "STOP TIMELINE: %u\n", state->stoptli); } - return result; + data = result->data; + pfree(result); + + return data; } |