Skip to content

Commit 586a8fc

Browse files
committed
Make use of psprintf() in recent changes
1 parent 36f4c78 commit 586a8fc

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
int ndig = 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-
int alloclen = 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy