Re: Clear up strxfrm() in UTF-8 with locale on Windows

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Clear up strxfrm() in UTF-8 with locale on Windows
Дата
Msg-id 21456.1178141139@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Clear up strxfrm() in UTF-8 with locale on Windows  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: Clear up strxfrm() in UTF-8 with locale on Windows  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-patches
Magnus Hagander <magnus@hagander.net> writes:
> Given this, perhaps the proper approach should instead be to just check
> the return value, and go from there? Should be a simple enough patch,
> something like the attached.

> Tom, can you comment?

Testing against INT_MAX seems like a type pun, or something.  Maybe use
MaxAllocSize instead?

    if (xfrmlen >= MaxAllocSize)
        return val;

Also, since as you note returning (size_t) -1 is not at all standard,
it would be helpful to readers to note that that's what Windows does
on failure and that's what you're testing for.  In fact you could
make a good case that the test should be just

    if (xfrmlen == (size_t) -1)
        return val;

            regards, tom lane

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Clear up strxfrm() in UTF-8 with locale on Windows
Следующее
От: Gavin Sherry
Дата:
Сообщение: Updated bitmap index patch