mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
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
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user