Bruce Momjian wrote:
> Bruce Momjian wrote:
> > Alvaro Herrera wrote:
> > > Bruce Momjian wrote:
> > >
> > > > I moved str_initcap() over into oracle_compat.c and then had initcap()
> > > > convert to/from TEXT to call it. The code is a little weird because
> > > > str_initcap() needs to convert to text to use texttowcs(), so in
> > > > multibyte encodings initcap converts the string to text, then to char,
> > > > then to text to call texttowcs(). I didn't see a cleaner way to do
> > > > this.
> > >
> > > Why not use wchar2char? It seems there's room for extra cleanup here.
> > >
> > > Also, the prototype of str_initcap in builtins.h looks out of place.
> > I talked to Alvaro on IM, and there is certainly much more cleanup to do
> > in this area. I will work from the bottom up. First, is moving the
> > USE_WIDE_UPPER_LOWER define to c.h, and removing TS_USE_WIDE and using
> > USE_WIDE_UPPER_LOWER instead. Patch attached and applied.
> The second step is to move wchar2char() and char2wchar() from tsearch
> into /mb to be easier to use for other modules; also move pnstrdup().
The third step is for oracle_compat.c::initcap() to use
formatting.c::str_initcap(). You can see the result; patch attached
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? If it is I will do the same for uppper()/lower()
with similar code size reduction and modularity.
If not perhaps I should keep the non-multibyte code in initcap() and
have only the multi-byte use str_initcap().
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
+ If your life is a hard drive, Christ can be your backup. +
In response to
pgsql-patches by date
|Next:||From: Tom Lane||Date: 2008-06-22 00:54:07|
|Subject: Re: Simplify formatting.c |
|Previous:||From: Simon Riggs||Date: 2008-06-20 16:52:12|
|Subject: Re: [HACKERS] Hint Bits and Write I/O|