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.



Reply via email to