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

Commit586a8fc

Browse files
committed
Make use of psprintf() in recent changes
1 parent36f4c78 commit586a8fc

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,16 +1010,12 @@ Datum
10101010
line_out(PG_FUNCTION_ARGS)
10111011
{
10121012
LINE*line=PG_GETARG_LINE_P(0);
1013-
char*buf;
10141013
intndig=DBL_DIG+extra_float_digits;
10151014

10161015
if (ndig<1)
10171016
ndig=1;
10181017

1019-
buf=palloc(ndig*3+5);
1020-
sprintf(buf,"{%.*g,%.*g,%.*g}",ndig,line->A,ndig,line->B,ndig,line->C);
1021-
1022-
PG_RETURN_CSTRING(buf);
1018+
PG_RETURN_CSTRING(psprintf("{%.*g,%.*g,%.*g}",ndig,line->A,ndig,line->B,ndig,line->C));
10231019
}
10241020

10251021
/*

‎src/backend/utils/error/elog.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,10 +2364,7 @@ log_line_prefix(StringInfo buf, ErrorData *edata)
23642364
*/
23652365

23662366
char*hostport;
2367-
intalloclen=strlen(MyProcPort->remote_host)+
2368-
strlen(MyProcPort->remote_port)+3;
2369-
hostport=palloc(alloclen);
2370-
sprintf(hostport,"%s(%s)",MyProcPort->remote_host,MyProcPort->remote_port);
2367+
hostport=psprintf("%s(%s)",MyProcPort->remote_host,MyProcPort->remote_port);
23712368
appendStringInfo(buf,"%*s",padding,hostport);
23722369
pfree(hostport);
23732370
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp