Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support
Date: 2001-08-23 18:18:07
Message-ID: 6240.998590687@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua> writes:
> #ifdef ENABLE_PLTCL_UTF
> #warning bubu
> # define UTF_BEGIN do { Tcl_DString _pltcl_ds_tmp;
> # define UTF_END Tcl_DStringFree(&_pltcl_ds_tmp); } while (0);
> # define UTF_U2E(x) (Tcl_UtfToExternalDString(NULL,(x),-1,\
> &_pltcl_ds_tmp))
> # define UTF_E2U(x) (Tcl_ExternalToUtfDString(NULL,(x),-1,\
> &_pltcl_ds_tmp))
> #else /* ENABLE_PLTCL_UTF */
> # define UTF_BEGIN
> # define UTF_END
> # define UTF_U2E(x) (x)
> # define UTF_E2U(x) (x)
> #endif /* ENABLE_PLTCL_UTF */

> and

> if (part != NULL)
> {
> UTF_BEGIN
> Tcl_DStringAppend(&unknown_src, UTF_E2U(part), -1);
> UTF_END
> pfree(part);
> }

> Is this looks better?

It does, but one small gripe: the lack of semicolons will probably cause
pg_indent to mess up the indentation. (I know emacs' autoindent mode
will not work nicely with it, either.) Please set up the macros so that
you write

UTF_BEGIN;
Tcl_DStringAppend(&unknown_src, UTF_E2U(part), -1);
UTF_END;

and then I'll be happy.

Your point about overhead is a good one, so I retract the gripe about
using a configure switch. But please include documentation patches to
describe the configure option in the administrator's guide (installation
section).

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Robert B. Easter 2001-08-23 18:37:27 JDBC patch for util.Serialize and jdbc2.PreparedStatement
Previous Message Tom Lane 2001-08-23 18:02:31 Re: insert multiple rows attempt two