Re: Remove redundant strlen call in ReplicationSlotValidateName

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: ranier(dot)vf(at)gmail(dot)com, amit(dot)kapila16(at)gmail(dot)com, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove redundant strlen call in ReplicationSlotValidateName
Date: 2021-07-16 10:05:29
Message-ID: CAApHDvqJ7yAq5UkDO92qqg32L4LvVF3o0ni3SVsO74q=TisfAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 16 Jul 2021 at 20:35, Japin Li <japinli(at)hotmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2021-07-16 10:09:40 Re: Added schema level support for publication.
Previous Message John Naylor 2021-07-16 10:02:49 Re: speed up verifying UTF-8