diff options
| author | Peter Eisentraut | 2025-02-12 07:50:13 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2025-02-12 07:50:13 +0000 |
| commit | 827b4060a8e35047c1adc9ca2ab3d8e7ad905df0 (patch) | |
| tree | 1235f34ef0ea04f9ccb22dd8f9c648e0e9c3ed06 /src/backend/storage | |
| parent | 506183bce73a2b22308a54876f0a56a249bc26e9 (diff) | |
Remove unnecessary (char *) casts [mem]
Remove (char *) casts around memory functions such as memcmp(),
memcpy(), or memset() where the cast is useless. Since these
functions don't take char * arguments anyway, these casts are at best
complicated casts to (void *), about which see commit 7f798aca1d5.
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/fd1fcedb-3492-4fc8-9e3e-74b97f2db6c7%40eisentraut.org
Diffstat (limited to 'src/backend/storage')
| -rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 2 | ||||
| -rw-r--r-- | src/backend/storage/buffer/localbuf.c | 2 | ||||
| -rw-r--r-- | src/backend/storage/file/fd.c | 4 | ||||
| -rw-r--r-- | src/backend/storage/page/bufpage.c | 8 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index ee83669992b..b5938f1b473 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -2221,7 +2221,7 @@ ExtendBufferedRelShared(BufferManagerRelation bmr, buf_block = BufHdrGetBlock(GetBufferDescriptor(buffers[i] - 1)); /* new buffers are zero-filled */ - MemSet((char *) buf_block, 0, BLCKSZ); + MemSet(buf_block, 0, BLCKSZ); } /* diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 8f81428970b..64931efaa75 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -338,7 +338,7 @@ ExtendBufferedRelLocal(BufferManagerRelation bmr, buf_block = LocalBufHdrGetBlock(buf_hdr); /* new buffers are zero-filled */ - MemSet((char *) buf_block, 0, BLCKSZ); + MemSet(buf_block, 0, BLCKSZ); } first_block = smgrnblocks(bmr.smgr, fork); diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 843d1021cf9..e454db4c020 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -910,7 +910,7 @@ InitFileAccess(void) (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of memory"))); - MemSet((char *) &(VfdCache[0]), 0, sizeof(Vfd)); + MemSet(&(VfdCache[0]), 0, sizeof(Vfd)); VfdCache->fd = VFD_CLOSED; SizeVfdCache = 1; @@ -1447,7 +1447,7 @@ AllocateVfd(void) */ for (i = SizeVfdCache; i < newCacheSize; i++) { - MemSet((char *) &(VfdCache[i]), 0, sizeof(Vfd)); + MemSet(&(VfdCache[i]), 0, sizeof(Vfd)); VfdCache[i].nextFree = i + 1; VfdCache[i].fd = VFD_CLOSED; } diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c index a931cdba151..424dd3f4bfb 100644 --- a/src/backend/storage/page/bufpage.c +++ b/src/backend/storage/page/bufpage.c @@ -415,7 +415,7 @@ PageRestoreTempPage(Page tempPage, Page oldPage) Size pageSize; pageSize = PageGetPageSize(tempPage); - memcpy((char *) oldPage, (char *) tempPage, pageSize); + memcpy(oldPage, tempPage, pageSize); pfree(tempPage); } @@ -1094,8 +1094,8 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum) ((char *) &phdr->pd_linp[offidx + 1] - (char *) phdr); if (nbytes > 0) - memmove((char *) &(phdr->pd_linp[offidx]), - (char *) &(phdr->pd_linp[offidx + 1]), + memmove(&(phdr->pd_linp[offidx]), + &(phdr->pd_linp[offidx + 1]), nbytes); /* @@ -1516,7 +1516,7 @@ PageSetChecksumCopy(Page page, BlockNumber blkno) PG_IO_ALIGN_SIZE, 0); - memcpy(pageCopy, (char *) page, BLCKSZ); + memcpy(pageCopy, page, BLCKSZ); ((PageHeader) pageCopy)->pd_checksum = pg_checksum_page(pageCopy, blkno); return pageCopy; } |
