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

Commit2075ba9

Browse files
committed
Tidy-up some appendStringInfo*() usages
Make a few newish calls to appendStringInfo() which have no specialformatting use appendStringInfoString() instead. Also, adjust usages ofappendStringInfoString() which only append a string containing a singlecharacter to make use of appendStringInfoChar() instead.This makes the code marginally faster, but primarily this change is sowe use the StringInfo type as it was intended to be used.Discussion:https://postgr.es/m/CAApHDvpXKQmL+r=VDNS98upqhr9yGBhv2Jw3GBFFk_wKHcB39A@mail.gmail.com
1 parent6b18b3f commit2075ba9

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

‎src/backend/access/rmgrdesc/heapdesc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ infobits_desc(StringInfo buf, uint8 infobits, const char *keyname)
4747
buf->data[buf->len]='\0';
4848
}
4949

50-
appendStringInfoString(buf,"]");
50+
appendStringInfoChar(buf,']');
5151
}
5252

5353
staticvoid
@@ -68,7 +68,7 @@ truncate_flags_desc(StringInfo buf, uint8 flags)
6868
buf->data[buf->len]='\0';
6969
}
7070

71-
appendStringInfoString(buf,"]");
71+
appendStringInfoChar(buf,']');
7272
}
7373

7474
staticvoid
@@ -88,7 +88,7 @@ plan_elem_desc(StringInfo buf, void *plan, void *data)
8888

8989
*offsets+=new_plan->ntuples;
9090

91-
appendStringInfo(buf," }");
91+
appendStringInfoString(buf," }");
9292
}
9393

9494
void

‎src/backend/access/rmgrdesc/nbtdesc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,5 +248,5 @@ delvacuum_desc(StringInfo buf, char *block_data,
248248
((char*)updates+SizeOfBtreeUpdate+
249249
updates->ndeletedtids*sizeof(uint16));
250250
}
251-
appendStringInfoString(buf,"]");
251+
appendStringInfoChar(buf,']');
252252
}

‎src/backend/access/rmgrdesc/rmgrdesc_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ array_desc(StringInfo buf, void *array, size_t elem_size, int count,
3737
if (i<count-1)
3838
appendStringInfoString(buf,", ");
3939
}
40-
appendStringInfoString(buf,"]");
40+
appendStringInfoChar(buf,']');
4141
}
4242

4343
void

‎src/backend/access/transam/xlogbackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ build_backup_content(BackupState *state, bool ishistoryfile)
5858

5959
appendStringInfo(result,"CHECKPOINT LOCATION: %X/%X\n",
6060
LSN_FORMAT_ARGS(state->checkpointloc));
61-
appendStringInfo(result,"BACKUP METHOD: streamed\n");
61+
appendStringInfoString(result,"BACKUP METHOD: streamed\n");
6262
appendStringInfo(result,"BACKUP FROM: %s\n",
6363
state->started_in_recovery ?"standby" :"primary");
6464
appendStringInfo(result,"START TIME: %s\n",startstrbuf);

‎src/backend/replication/slot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ ReportSlotInvalidation(ReplicationSlotInvalidationCause cause,
12821282
break;
12831283

12841284
caseRS_INVAL_WAL_LEVEL:
1285-
appendStringInfo(&err_detail,_("Logical decoding on standby requires wal_level >= logical on the primary server."));
1285+
appendStringInfoString(&err_detail,_("Logical decoding on standby requires wal_level >= logical on the primary server."));
12861286
break;
12871287
caseRS_INVAL_NONE:
12881288
pg_unreachable();

‎src/backend/utils/adt/ruleutils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10395,7 +10395,7 @@ get_func_sql_syntax(FuncExpr *expr, deparse_context *context)
1039510395

1039610396
caseF_IS_NORMALIZED:
1039710397
/* IS xxx NORMALIZED */
10398-
appendStringInfoString(buf,"(");
10398+
appendStringInfoChar(buf,'(');
1039910399
get_rule_expr_paren((Node*)linitial(expr->args),context, false,
1040010400
(Node*)expr);
1040110401
appendStringInfoString(buf," IS");
@@ -10884,7 +10884,7 @@ get_json_constructor(JsonConstructorExpr *ctor, deparse_context *context,
1088410884
}
1088510885

1088610886
get_json_constructor_options(ctor,buf);
10887-
appendStringInfo(buf,")");
10887+
appendStringInfoChar(buf,')');
1088810888
}
1088910889

1089010890
/*

‎src/test/regress/pg_regress.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,9 +2339,9 @@ regression_main(int argc, char *argv[],
23392339
bindir ?"/" :"",
23402340
temp_instance);
23412341
if (debug)
2342-
appendStringInfo(&cmd," --debug");
2342+
appendStringInfoString(&cmd," --debug");
23432343
if (nolocale)
2344-
appendStringInfo(&cmd," --no-locale");
2344+
appendStringInfoString(&cmd," --no-locale");
23452345
appendStringInfo(&cmd," > \"%s/log/initdb.log\" 2>&1",outputdir);
23462346
fflush(NULL);
23472347
if (system(cmd.data))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp