Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support - Mailing list pgsql-patches

From Tom Lane
Subject Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support
Date
Msg-id 6240.998590687@sss.pgh.pa.us
Whole thread Raw
In response to Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support  (Vsevolod Lobko <seva@sevasoft.kiev.ua>)
Responses Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support
List pgsql-patches
Vsevolod Lobko <seva@sevasoft.kiev.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

pgsql-patches by date:

Previous
From: Vsevolod Lobko
Date:
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support
Next
From: Vsevolod Lobko
Date:
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support