Re: Text <-> C string - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Text <-> C string
Date
Msg-id 27654.1190416142@sss.pgh.pa.us
Whole thread Raw
In response to Re: Text <-> C string  ("Brendan Jurd" <direvus@gmail.com>)
Responses Re: Text <-> C string
Re: Text <-> C string
List pgsql-hackers
"Brendan Jurd" <direvus@gmail.com> writes:
> I just noticed a couple of macros defined in src/include/tsearch/ts_utils.h:

> #define TextPGetCString(t)
> DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(t)))
> #define CStringGetTextP(c) DatumGetTextP(DirectFunctionCall1(textin,
> CStringGetDatum(c)))

> Seems these would actually be convenient in quite a lot of places in
> the backend.  Is there any downside to moving these two into
> src/include/postgres.h?

I think if you look around you'll find several similar things in various
contrib modules.  It would make some sense to try to unify all this.
I'm not particularly for making it macros in postgres.h though ---
that's no help if the macros require referencing stuff in builtins.h.

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.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Open issues for HOT patch
Next
From: "Guillaume Smet"
Date:
Subject: Re: like/ilike improvements