From: | "Brendan Jurd" <direvus(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Gregory Stark" <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Text <-> C string |
Date: | 2007-09-27 13:41:52 |
Message-ID: | 37ed240d0709270641t1b680ccw553ecfdff3efc2d@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
On 9/22/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> On grounds of code-space savings I think it might be worth making
> these things be simple functions declared in builtins.h; that would
> also make it much easier to change their implementations.
I've noticed that this pattern isn't exclusive to the text type; other
varlena types like bytea and xmltype seem to have a common requirement
to translate to and fro C strings for various jobs.
Does it make sense to go one level lower, and make these functions
work for any varlena?
So far, I've got the following functions doing the work:
char * text_cstring(text *t)
char * text_cstring_limit(text *t, int len)
text * cstring_text(char *s)
It wouldn't be difficult at this point to make those functions
'varlena' rather than 'text', and then bytea and xmltype (and any
other future types that want to inherit from varlena) can take
advantage of them.
Thanks for your time,
BJ
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-09-27 13:48:54 | Re: Text <-> C string |
Previous Message | Brendan Jurd | 2007-09-27 12:53:06 | Re: Eliminate more detoast copies for packed varlenas |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-09-27 13:48:54 | Re: Text <-> C string |
Previous Message | Brendan Jurd | 2007-09-27 12:53:06 | Re: Eliminate more detoast copies for packed varlenas |