Re: adding strndup

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: adding strndup
Дата
Msg-id 20191204220146.GA28850@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: adding strndup  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: adding strndup  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2019-Dec-04, Alvaro Herrera wrote:

> On 2019-Dec-04, Tom Lane wrote:
> 
> > Andres Freund <andres@anarazel.de> writes:
> > > On 2019-12-04 11:40:21 -0300, Alvaro Herrera wrote:
> > >> I think this should be pretty uncontroversial, but wanted to give a
> > >> heads-up outside that thread.  I attach the patch here for completeness.
> > 
> > > I'd just provide pnstrdup() in the frontend, without adding strndup().
> > 
> > +1 --- seems like a bunch more mechanism than is warranted.  Let's
> > just open-code it in pnstrdup.  We can rely on strnlen, since that's
> > already supported, and there's not much more there beyond that.
> 
> I can get behind that ... it makes the patch a lot smaller.

Here it is.

I noticed that ECPG's copy was setting errno.  I had forgot to do that
in my previous patch, but on second look, malloc failure already sets
it, so doing it again is pointless.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: more backtraces
Следующее
От: Tom Lane
Дата:
Сообщение: Re: adding strndup