Re: Remove redundant strlen call in ReplicationSlotValidateName - Mailing list pgsql-hackers

From David Rowley
Subject Re: Remove redundant strlen call in ReplicationSlotValidateName
Date
Msg-id CAApHDvqJ7yAq5UkDO92qqg32L4LvVF3o0ni3SVsO74q=TisfAg@mail.gmail.com
Whole thread Raw
In response to Re: Remove redundant strlen call in ReplicationSlotValidateName  (Japin Li <japinli@hotmail.com>)
Responses Re: Remove redundant strlen call in ReplicationSlotValidateName  (Japin Li <japinli@hotmail.com>)
Re: Remove redundant strlen call in ReplicationSlotValidateName  (Ranier Vilela <ranier.vf@gmail.com>)
Re: Remove redundant strlen call in ReplicationSlotValidateName  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On Fri, 16 Jul 2021 at 20:35, Japin Li <japinli@hotmail.com> wrote:
> > When I fix a bug about ALTER SUBSCRIPTION ... SET (slot_name) [1], Ranier Vilela
> > finds that ReplicationSlotValidateName() has redundant strlen() call, Since it's
> > not related to that problem, so I start a new thread to discuss it.

I think this is a waste of time.  The first strlen() call is just
checking for an empty string. I imagine all compilers would just
optimise that to checking if the first char is '\0';

https://godbolt.org/z/q58EGYMfM

David



pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: speed up verifying UTF-8
Next
From: vignesh C
Date:
Subject: Re: Added schema level support for publication.