Skip to content

Commit 1b5841d

Browse files
committed
Remove unnecessary (char *) casts [checksum]
Remove some (char *) casts related to uses of the pg_checksum_page() function. These casts are useless, because everything involved already has the right type. Moreover, these casts actually silently discarded a const qualifier. The declaration of a higher-level function needs to be adjusted to fix that. Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Discussion: https://www.postgresql.org/message-id/flat/fd1fcedb-3492-4fc8-9e3e-74b97f2db6c7%40eisentraut.org
1 parent 827b406 commit 1b5841d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

contrib/pageinspect/rawpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ page_checksum_internal(PG_FUNCTION_ARGS, enum pageinspect_version ext_version)
357357
if (PageIsNew(page))
358358
PG_RETURN_NULL();
359359

360-
PG_RETURN_INT16(pg_checksum_page((char *) page, blkno));
360+
PG_RETURN_INT16(pg_checksum_page(page, blkno));
361361
}
362362

363363
Datum

src/backend/storage/page/bufpage.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ PageInit(Page page, Size pageSize, Size specialSize)
8585
* to pgstat.
8686
*/
8787
bool
88-
PageIsVerifiedExtended(const PageData *page, BlockNumber blkno, int flags)
88+
PageIsVerifiedExtended(PageData *page, BlockNumber blkno, int flags)
8989
{
9090
const PageHeaderData *p = (const PageHeaderData *) page;
9191
size_t *pagebytes;
@@ -100,7 +100,7 @@ PageIsVerifiedExtended(const PageData *page, BlockNumber blkno, int flags)
100100
{
101101
if (DataChecksumsEnabled())
102102
{
103-
checksum = pg_checksum_page((char *) page, blkno);
103+
checksum = pg_checksum_page(page, blkno);
104104

105105
if (checksum != p->pd_checksum)
106106
checksum_failure = true;
@@ -1534,5 +1534,5 @@ PageSetChecksumInplace(Page page, BlockNumber blkno)
15341534
if (PageIsNew(page) || !DataChecksumsEnabled())
15351535
return;
15361536

1537-
((PageHeader) page)->pd_checksum = pg_checksum_page((char *) page, blkno);
1537+
((PageHeader) page)->pd_checksum = pg_checksum_page(page, blkno);
15381538
}

src/include/storage/bufpage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ StaticAssertDecl(BLCKSZ == ((BLCKSZ / sizeof(size_t)) * sizeof(size_t)),
489489
"BLCKSZ has to be a multiple of sizeof(size_t)");
490490

491491
extern void PageInit(Page page, Size pageSize, Size specialSize);
492-
extern bool PageIsVerifiedExtended(const PageData *page, BlockNumber blkno, int flags);
492+
extern bool PageIsVerifiedExtended(PageData *page, BlockNumber blkno, int flags);
493493
extern OffsetNumber PageAddItemExtended(Page page, Item item, Size size,
494494
OffsetNumber offsetNumber, int flags);
495495
extern Page PageGetTempPage(const PageData *page);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy