Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f92d6a5

Browse files
committed
Use appendStringInfoString/Char et al where appropriate.
Patch by David Rowley. Backpatch to 9.5, as some of the calls were new in 9.5, and keeping the code in sync with master makes future backpatching easier.
1 parent 7931622 commit f92d6a5

File tree

17 files changed

+32
-32
lines changed

17 files changed

+32
-32
lines changed

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2738,7 +2738,7 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid)
27382738
}
27392739

27402740
/* Append ORDER BY at the end of query to ensure output ordering */
2741-
appendStringInfo(&buf, " ORDER BY c.relname, a.attnum");
2741+
appendStringInfoString(&buf, " ORDER BY c.relname, a.attnum");
27422742

27432743
/* Fetch the data */
27442744
res = PQexec(conn, buf.data);

src/backend/access/rmgrdesc/gindesc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ gin_desc(StringInfo buf, XLogReaderState *record)
113113
(ginxlogRecompressDataLeaf *) payload;
114114

115115
if (XLogRecHasBlockImage(record, 0))
116-
appendStringInfo(buf, " (full page image)");
116+
appendStringInfoString(buf, " (full page image)");
117117
else
118118
desc_recompress_leaf(buf, insertData);
119119
}
@@ -147,7 +147,7 @@ gin_desc(StringInfo buf, XLogReaderState *record)
147147
ginxlogVacuumDataLeafPage *xlrec = (ginxlogVacuumDataLeafPage *) rec;
148148

149149
if (XLogRecHasBlockImage(record, 0))
150-
appendStringInfo(buf, " (full page image)");
150+
appendStringInfoString(buf, " (full page image)");
151151
else
152152
desc_recompress_leaf(buf, &xlrec->data);
153153
}

src/backend/access/rmgrdesc/spgdesc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ spg_desc(StringInfo buf, XLogReaderState *record)
3030
{
3131
spgxlogAddLeaf *xlrec = (spgxlogAddLeaf *) rec;
3232

33-
appendStringInfo(buf, "add leaf to page");
33+
appendStringInfoString(buf, "add leaf to page");
3434
appendStringInfo(buf, "; off %u; headoff %u; parentoff %u",
3535
xlrec->offnumLeaf, xlrec->offnumHeadLeaf,
3636
xlrec->offnumParent);
3737
if (xlrec->newPage)
38-
appendStringInfo(buf, " (newpage)");
38+
appendStringInfoString(buf, " (newpage)");
3939
if (xlrec->storesNulls)
40-
appendStringInfo(buf, " (nulls)");
40+
appendStringInfoString(buf, " (nulls)");
4141
}
4242
break;
4343
case XLOG_SPGIST_MOVE_LEAFS:
@@ -63,9 +63,9 @@ spg_desc(StringInfo buf, XLogReaderState *record)
6363
appendStringInfo(buf, "ndel %u; nins %u",
6464
xlrec->nDelete, xlrec->nInsert);
6565
if (xlrec->innerIsParent)
66-
appendStringInfo(buf, " (innerIsParent)");
66+
appendStringInfoString(buf, " (innerIsParent)");
6767
if (xlrec->isRootSplit)
68-
appendStringInfo(buf, " (isRootSplit)");
68+
appendStringInfoString(buf, " (isRootSplit)");
6969
}
7070
break;
7171
case XLOG_SPGIST_VACUUM_LEAF:

src/backend/access/rmgrdesc/xactdesc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId
232232
}
233233

234234
if (XactCompletionForceSyncCommit(parsed.xinfo))
235-
appendStringInfo(buf, "; sync");
235+
appendStringInfoString(buf, "; sync");
236236

237237
if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN)
238238
{

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ XLogInsertRecord(XLogRecData *rdata, XLogRecPtr fpw_lsn)
10971097

10981098
if (!debug_reader)
10991099
{
1100-
appendStringInfo(&buf, "error decoding record: out of memory");
1100+
appendStringInfoString(&buf, "error decoding record: out of memory");
11011101
}
11021102
else if (!DecodeXLogRecord(debug_reader, (XLogRecord *) recordBuf.data,
11031103
&errormsg))
@@ -9528,7 +9528,7 @@ xlog_outrec(StringInfo buf, XLogReaderState *record)
95289528
rnode.spcNode, rnode.dbNode, rnode.relNode,
95299529
blk);
95309530
if (XLogRecHasBlockImage(record, block_id))
9531-
appendStringInfo(buf, " FPW");
9531+
appendStringInfoString(buf, " FPW");
95329532
}
95339533
}
95349534
#endif /* WAL_DEBUG */

src/backend/lib/pairingheap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ pairingheap_dump_recurse(StringInfo buf,
306306

307307
appendStringInfoSpaces(buf, depth * 4);
308308
dumpfunc(node, buf, opaque);
309-
appendStringInfoString(buf, "\n");
309+
appendStringInfoChar(buf, '\n');
310310
if (node->first_child)
311311
pairingheap_dump_recurse(buf, node->first_child, dumpfunc, opaque, depth + 1, node);
312312
prev_or_parent = node;

src/backend/utils/adt/ruleutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5487,7 +5487,7 @@ get_insert_query_def(Query *query, deparse_context *context)
54875487
{
54885488
OnConflictExpr *confl = query->onConflict;
54895489

5490-
appendStringInfo(buf, " ON CONFLICT");
5490+
appendStringInfoString(buf, " ON CONFLICT");
54915491

54925492
if (confl->arbiterElems)
54935493
{

src/backend/utils/adt/xml.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,7 +2473,7 @@ query_to_xml_internal(const char *query, char *tablename,
24732473
{
24742474
xmldata_root_element_start(result, xmltn, xmlschema,
24752475
targetns, top_level);
2476-
appendStringInfoString(result, "\n");
2476+
appendStringInfoChar(result, '\n');
24772477
}
24782478

24792479
if (xmlschema)
@@ -2637,7 +2637,7 @@ schema_to_xml_internal(Oid nspid, const char *xmlschema, bool nulls,
26372637
result = makeStringInfo();
26382638

26392639
xmldata_root_element_start(result, xmlsn, xmlschema, targetns, top_level);
2640-
appendStringInfoString(result, "\n");
2640+
appendStringInfoChar(result, '\n');
26412641

26422642
if (xmlschema)
26432643
appendStringInfo(result, "%s\n\n", xmlschema);
@@ -2815,7 +2815,7 @@ database_to_xml_internal(const char *xmlschema, bool nulls,
28152815
result = makeStringInfo();
28162816

28172817
xmldata_root_element_start(result, xmlcn, xmlschema, targetns, true);
2818-
appendStringInfoString(result, "\n");
2818+
appendStringInfoChar(result, '\n');
28192819

28202820
if (xmlschema)
28212821
appendStringInfo(result, "%s\n\n", xmlschema);

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ GenerateRecoveryConf(PGconn *conn)
15161516

15171517
/* Separate key-value pairs with spaces */
15181518
if (conninfo_buf.len != 0)
1519-
appendPQExpBufferStr(&conninfo_buf, " ");
1519+
appendPQExpBufferChar(&conninfo_buf, ' ');
15201520

15211521
/*
15221522
* Write "keyword=value" pieces, the value string is escaped and/or

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ RestoreArchive(Archive *AHX)
533533
* search for hardcoded "DROP CONSTRAINT" instead.
534534
*/
535535
if (strcmp(te->desc, "DEFAULT") == 0)
536-
appendPQExpBuffer(ftStmt, "%s", dropStmt);
536+
appendPQExpBufferStr(ftStmt, dropStmt);
537537
else
538538
{
539539
if (strcmp(te->desc, "CONSTRAINT") == 0 ||

0 commit comments

Comments
 (0)