1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

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 7f798aca1d.

Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://www.postgresql.org/message-id/flat/fd1fcedb-3492-4fc8-9e3e-74b97f2db6c7%40eisentraut.org
This commit is contained in:
Peter Eisentraut
2025-02-12 08:50:13 +01:00
parent 506183bce7
commit 827b4060a8
20 changed files with 44 additions and 48 deletions

View File

@@ -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);
}
/*

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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;
}