Re: [PATCH] Add function to_oct

Поиск
Список
Период
Сортировка
От John Naylor
Тема Re: [PATCH] Add function to_oct
Дата
Msg-id CAFBsxsEm0VGAipmQNK-EZ1a8ej6PDF+2aEkYGbktKH9aHFb4Dw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Add function to_oct  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: [PATCH] Add function to_oct  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-hackers

On Wed, Aug 16, 2023 at 12:17 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> On Tue, Aug 15, 2023 at 01:53:25PM +0700, John Naylor wrote:

> > - *ptr = '\0';
> > + Assert(base == 2 || base == 8 || base == 16);
> >
> > + *ptr = '\0';
> >
> > Spurious whitespace change?
>
> I think this might just be a weird artifact of the diff algorithm.

Don't believe everything you think. :-)

```
*ptr = '\0';

do
```

to

```
*ptr = '\0';
do
```

> > - char buf[32]; /* bigger than needed, but reasonable */
> > + char   *buf = palloc(sizeof(uint64) * BITS_PER_BYTE + 1);
> >
> > Why is this no longer allocated on the stack? Maybe needs a comment about
> > the size calculation.
>
> It really should be.  IIRC I wanted to avoid passing a pre-allocated buffer
> to convert_to_base(), but I don't remember why.  I fixed this in v5.

Now I'm struggling to understand why each and every instance has its own nominal buffer, passed down to the implementation. All we care about is the result -- is there some reason not to confine the buffer declaration to the general implementation?

--
John Naylor
EDB: http://www.enterprisedb.com

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

Предыдущее
От: "Hayato Kuroda (Fujitsu)"
Дата:
Сообщение: RE: [PoC] pg_upgrade: allow to upgrade publisher node
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pg_logical_emit_message() misses a XLogFlush()