Re: Simplify formatting.c

Bruce Momjian <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.patches
Message-ID <[email protected]>
Tom Lane wrote:
> Bruce Momjian <[email protected]> writes:
> > The third step is for oracle_compat.c::initcap() to use
> > formatting.c::str_initcap().  You can see the result;  patch attached
> > (not applied).
> 
> > This greatly reduces the size of initcap(), with the downside that we
> > are making two extra copies of the string to convert it to/from char*.
> 
> > Is this acceptable?
> 
> I'd say not.  Can't we do some more refactoring and avoid so many
> useless conversions?  Seems like str_initcap is the wrong primitive API
> --- the work ought to be done by a function that takes a char pointer
> and a length.  That would be a suitable basis for functions operating
> on both text datums and C strings.

Yea, I thought about that idea too but it is going to add a strlen()
calls in some places, but not in critical ones.

> (Perhaps what I should be asking is whether the performance of upper()
> and lower() is equally bad.  Certainly all three should have comparable
> code, so maybe they all need refactoring.)

Yes, they do.  I will work on the length idea and see how that goes.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-patches mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.