Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support

Поиск
Список
Период
Сортировка
От Vsevolod Lobko
Тема Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support
Дата
Msg-id 20010823205540.L40612-100000@localhost
обсуждение исходный текст
Ответ на Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches

On Thu, 23 Aug 2001, Tom Lane wrote:

> Vsevolod Lobko <seva@sevasoft.kiev.ua> writes:
> > This patch adds calls to Tcl_ExternalToUtf and Tcl_UtfToExternal
> > functions on parameters of SPI functions.
>
> I hate to say it, but this is an amazingly ugly patch.  Can't you
> do it without so many #ifdefs and duplicating a lot of code?  Think
> of the next guy who has to look at/work on this code.
>
> Possibly a macro that invokes Tcl_ExternalToUtfDString or does nothing
> might help.

something like this?

#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?


В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support
Следующее
От: Tom Lane
Дата:
Сообщение: Re: insert multiple rows attempt two