Skip site navigation (1) Skip section navigation (2)

Re: Simplify formatting.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Euler Taveira de Oliveira <euler(at)timbira(dot)com>
Subject: Re: Simplify formatting.c
Date: 2008-06-22 01:59:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> 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.

Sure, but the cost-per-byte of the strlen should be a good bit less than
the cost-per-byte of the actual conversion, so that doesn't bother me
too much.

Actually it seems like the hard part is not so much the input
representation as the output representation --- what should the
base-level initcap routine return, to be reasonably efficient for
both cases?

			regards, tom lane

In response to


pgsql-patches by date

Next:From: Bruce MomjianDate: 2008-06-22 02:43:28
Subject: Re: Simplify formatting.c
Previous:From: Bruce MomjianDate: 2008-06-22 01:49:33
Subject: Re: Simplify formatting.c

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group