Re: Modernize const handling with readline

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Modernize const handling with readline
Дата
Msg-id e08317a0-a2e7-c60d-c14a-ad9fc34f8f6c@eisentraut.org
обсуждение исходный текст
Ответ на Re: Modernize const handling with readline  (Aleksander Alekseev <aleksander@timescale.com>)
Ответы Re: Modernize const handling with readline  (Aleksander Alekseev <aleksander@timescale.com>)
Список pgsql-hackers
On 03.10.23 13:28, Aleksander Alekseev wrote:
> While examining the code for similar places I noticed that the
> following functions can also be const'ified:
> 
> - crc32_sz

I suppose this could be changed.

> - pg_checksum_page (? temporary modifies the page but then restores it)

Then it's not really const?

> - XLogRegisterData (?)

I don't think this would work, at least without further work elsewhere, 
because the data is stored in XLogRecData, which has no const handling.

> The callers of cstring_to_text[_with_len] often cast the argument to
> (char *) while in fact it's (const char *). This can be refactored
> too.

These look fine to me.

> Additionally there is a slight difference between XLogRegisterBlock()
> declaration in xloginsert.h:
> 
> ```
> extern void XLogRegisterBlock(uint8 block_id, RelFileLocator *rlocator,
>                                ForkNumber forknum, BlockNumber blknum,
> char *page,
>                                uint8 flags);
> ```
> 
> ... and xloginsert.c:
> 
> ```
> void
> XLogRegisterBlock(uint8 block_id, RelFileLocator *rlocator, ForkNumber forknum,
>                    BlockNumber blknum, Page page, uint8 flags)
> ```

It looks like the reason here is that xloginsert.h does not have the 
Page type in scope.  I don't know how difficult it would be to change 
that, but it seems fine as is.




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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: --sync-method isn't documented to take an argument
Следующее
От: Robert Haas
Дата:
Сообщение: Re: --sync-method isn't documented to take an argument