Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit32ceba3

Browse files
committed
Replace appendPQExpBuffer(..., <constant>) with appendPQExpBufferStr
Arguably makes the code a bit more readable, and might give a smallperformance gain.David Rowley
1 parentf1df473 commit32ceba3

File tree

15 files changed

+739
-750
lines changed

15 files changed

+739
-750
lines changed

‎src/bin/pg_dump/dumputils.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ fmtQualifiedId(int remoteVersion, const char *schema, const char *id)
168168
{
169169
appendPQExpBuffer(lcl_pqexp,"%s.",fmtId(schema));
170170
}
171-
appendPQExpBuffer(lcl_pqexp,"%s",fmtId(id));
171+
appendPQExpBufferStr(lcl_pqexp,fmtId(id));
172172

173173
id_return=getLocalPQExpBuffer();
174174

175-
appendPQExpBuffer(id_return,"%s",lcl_pqexp->data);
175+
appendPQExpBufferStr(id_return,lcl_pqexp->data);
176176
destroyPQExpBuffer(lcl_pqexp);
177177

178178
returnid_return->data;
@@ -625,7 +625,7 @@ buildACLCommands(const char *name, const char *subname,
625625
appendPQExpBuffer(secondsql,"%sGRANT %s ON %s %s TO ",
626626
prefix,privs->data,type,name);
627627
if (grantee->len==0)
628-
appendPQExpBuffer(secondsql,"PUBLIC;\n");
628+
appendPQExpBufferStr(secondsql,"PUBLIC;\n");
629629
elseif (strncmp(grantee->data,"group ",
630630
strlen("group "))==0)
631631
appendPQExpBuffer(secondsql,"GROUP %s;\n",
@@ -638,19 +638,19 @@ buildACLCommands(const char *name, const char *subname,
638638
appendPQExpBuffer(secondsql,"%sGRANT %s ON %s %s TO ",
639639
prefix,privswgo->data,type,name);
640640
if (grantee->len==0)
641-
appendPQExpBuffer(secondsql,"PUBLIC");
641+
appendPQExpBufferStr(secondsql,"PUBLIC");
642642
elseif (strncmp(grantee->data,"group ",
643643
strlen("group "))==0)
644644
appendPQExpBuffer(secondsql,"GROUP %s",
645645
fmtId(grantee->data+strlen("group ")));
646646
else
647-
appendPQExpBuffer(secondsql,"%s",fmtId(grantee->data));
648-
appendPQExpBuffer(secondsql," WITH GRANT OPTION;\n");
647+
appendPQExpBufferStr(secondsql,fmtId(grantee->data));
648+
appendPQExpBufferStr(secondsql," WITH GRANT OPTION;\n");
649649
}
650650

651651
if (grantor->len>0
652652
&& (!owner||strcmp(owner,grantor->data)!=0))
653-
appendPQExpBuffer(secondsql,"RESET SESSION AUTHORIZATION;\n");
653+
appendPQExpBufferStr(secondsql,"RESET SESSION AUTHORIZATION;\n");
654654
}
655655
}
656656
}
@@ -947,7 +947,7 @@ AddAcl(PQExpBuffer aclbuf, const char *keyword, const char *subname)
947947
{
948948
if (aclbuf->len>0)
949949
appendPQExpBufferChar(aclbuf,',');
950-
appendPQExpBuffer(aclbuf,"%s",keyword);
950+
appendPQExpBufferStr(aclbuf,keyword);
951951
if (subname)
952952
appendPQExpBuffer(aclbuf,"(%s)",subname);
953953
}
@@ -1205,7 +1205,7 @@ emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer,
12051205
" %s IS ",
12061206
fmtId(objname));
12071207
appendStringLiteralConn(buffer,label,conn);
1208-
appendPQExpBuffer(buffer,";\n");
1208+
appendPQExpBufferStr(buffer,";\n");
12091209
}
12101210
}
12111211

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,16 +2619,16 @@ _doSetSessionAuth(ArchiveHandle *AH, const char *user)
26192619
{
26202620
PQExpBuffercmd=createPQExpBuffer();
26212621

2622-
appendPQExpBuffer(cmd,"SET SESSION AUTHORIZATION ");
2622+
appendPQExpBufferStr(cmd,"SET SESSION AUTHORIZATION ");
26232623

26242624
/*
26252625
* SQL requires a string literal here.Might as well be correct.
26262626
*/
26272627
if (user&&*user)
26282628
appendStringLiteralAHX(cmd,user,AH);
26292629
else
2630-
appendPQExpBuffer(cmd,"DEFAULT");
2631-
appendPQExpBuffer(cmd,";");
2630+
appendPQExpBufferStr(cmd,"DEFAULT");
2631+
appendPQExpBufferChar(cmd,';');
26322632

26332633
if (RestoringToDB(AH))
26342634
{
@@ -2798,7 +2798,7 @@ _selectOutputSchema(ArchiveHandle *AH, const char *schemaName)
27982798
appendPQExpBuffer(qry,"SET search_path = %s",
27992799
fmtId(schemaName));
28002800
if (strcmp(schemaName,"pg_catalog")!=0)
2801-
appendPQExpBuffer(qry,", pg_catalog");
2801+
appendPQExpBufferStr(qry,", pg_catalog");
28022802

28032803
if (RestoringToDB(AH))
28042804
{
@@ -2853,7 +2853,7 @@ _selectTablespace(ArchiveHandle *AH, const char *tablespace)
28532853
if (strcmp(want,"")==0)
28542854
{
28552855
/* We want the tablespace to be the database's default */
2856-
appendPQExpBuffer(qry,"SET default_tablespace = ''");
2856+
appendPQExpBufferStr(qry,"SET default_tablespace = ''");
28572857
}
28582858
else
28592859
{
@@ -3119,7 +3119,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
31193119
{
31203120
PQExpBuffertemp=createPQExpBuffer();
31213121

3122-
appendPQExpBuffer(temp,"ALTER ");
3122+
appendPQExpBufferStr(temp,"ALTER ");
31233123
_getObjectDescription(temp,te,AH);
31243124
appendPQExpBuffer(temp," OWNER TO %s;",fmtId(te->owner));
31253125
ahprintf(AH,"%s\n\n",temp->data);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp