Re: Duplicated assignment of slot_name in walsender.c

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Euler Taveira <euler@timbira.com.br>, Bernd Helmle <mailings@oopsware.de>, pgsql-hackers@postgresql.org
Date: 2015-10-21T22:42:12Z
Lists: pgsql-hackers
On 2015-10-21 19:36:16 -0300, Alvaro Herrera wrote:
> 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;

If you want to do that, I'm unenthusiastically not objecting. But if so,
let's also do it in IdentifySystem(), SendTimeLineHistory(),
StartReplication(), SendBackupHeader(), SendXLogRecPtResult() - they're
modeled after each other.

Do you want to commit the slot_name with the rest or do you want me to
do that?

Greetings,

Andres Freund


Commits

  1. Measure string lengths only once