Re: Duplicated assignment of slot_name in walsender.c
José Luis Tallón <jltallon@adv-solutions.net>
From: José Luis Tallón <jltallon@adv-solutions.net>
To: Alvaro Herrera <alvherre@2ndquadrant.com>,
Andres Freund <andres@anarazel.de>
Cc: Euler Taveira <euler@timbira.com.br>, Bernd Helmle <mailings@oopsware.de>,
pgsql-hackers@postgresql.org
Date: 2015-10-22T12:48:16Z
Lists: pgsql-hackers
On 10/22/2015 12:36 AM, Alvaro Herrera wrote:
> Andres Freund wrote:
>
>> That seems fairly insignificant. For one this is a rather infrequent and
>> expensive operation, for another every decent compiler can optimize
>> those away. Note that those duplicate strlen() calls are there in a lot
>> of places in walsender.c
> diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
> index c6043cd..5487cc0 100644
> --- a/src/backend/replication/walsender.c
> +++ b/src/backend/replication/walsender.c
> @@ -762,10 +762,10 @@ logical_read_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, int req
> static void
> CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
> {
> - const char *slot_name;
> const char *snapshot_name = NULL;
> char xpos[MAXFNAMELEN];
> StringInfoData buf;
> + int len;
Surely "size_t len" ?
Or am I missing some platform where size_t is not defined ?
Minor nitpicking, of course. But once we are cleaning the code up,
might as well change this too....
Thanks!
/ J.L.
Commits
-
Measure string lengths only once
- fa171654f273 9.4.6 landed
- 80ae841f2f0c 9.5.0 landed
- 0cd836a4e818 9.6.0 landed