mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Make use of psprintf() in recent changes
This commit is contained in:
parent
36f4c7843c
commit
586a8fc75b
@ -1010,16 +1010,12 @@ Datum
|
||||
line_out(PG_FUNCTION_ARGS)
|
||||
{
|
||||
LINE *line = PG_GETARG_LINE_P(0);
|
||||
char *buf;
|
||||
int ndig = DBL_DIG + extra_float_digits;
|
||||
|
||||
if (ndig < 1)
|
||||
ndig = 1;
|
||||
|
||||
buf = palloc(ndig * 3 + 5);
|
||||
sprintf(buf, "{%.*g,%.*g,%.*g}", ndig, line->A, ndig, line->B, ndig, line->C);
|
||||
|
||||
PG_RETURN_CSTRING(buf);
|
||||
PG_RETURN_CSTRING(psprintf("{%.*g,%.*g,%.*g}", ndig, line->A, ndig, line->B, ndig, line->C));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2364,10 +2364,7 @@ log_line_prefix(StringInfo buf, ErrorData *edata)
|
||||
*/
|
||||
|
||||
char *hostport;
|
||||
int alloclen = strlen(MyProcPort->remote_host) +
|
||||
strlen(MyProcPort->remote_port) + 3;
|
||||
hostport = palloc(alloclen);
|
||||
sprintf(hostport, "%s(%s)", MyProcPort->remote_host, MyProcPort->remote_port);
|
||||
hostport = psprintf("%s(%s)", MyProcPort->remote_host, MyProcPort->remote_port);
|
||||
appendStringInfo(buf, "%*s", padding, hostport);
|
||||
pfree(hostport);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user