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

Inline memset() as MemSet().

This commit is contained in:
Bruce Momjian
1997-09-18 20:22:58 +00:00
parent c3072cb1f0
commit 3f365ba0fc
68 changed files with 218 additions and 218 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.13 1997/09/18 14:19:58 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.14 1997/09/18 20:21:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -175,7 +175,7 @@ InitBufferPool(IPCKey key)
(BMT_LIMIT * sizeof(bmtrace)) + sizeof(long),
&foundDescs);
if (!foundDescs)
memset(CurTraceBuf, 0, (BMT_LIMIT * sizeof(bmtrace)) + sizeof(long));
MemSet(CurTraceBuf, 0, (BMT_LIMIT * sizeof(bmtrace)) + sizeof(long));
TraceBuf = (bmtrace *) & (CurTraceBuf[1]);
#endif

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.24 1997/09/18 14:20:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.25 1997/09/18 20:21:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -271,7 +271,7 @@ ReadBufferWithBufferLock(Relation reln,
if (extend)
{
/* new buffers are zero-filled */
memset((char *) MAKE_PTR(bufHdr->data), 0, BLCKSZ);
MemSet((char *) MAKE_PTR(bufHdr->data), 0, BLCKSZ);
smgrextend(bufHdr->bufsmgr, reln,
(char *) MAKE_PTR(bufHdr->data));
}
@@ -286,7 +286,7 @@ ReadBufferWithBufferLock(Relation reln,
if (extend)
{
/* new buffers are zero-filled */
memset((char *) MAKE_PTR(bufHdr->data), 0, BLCKSZ);
MemSet((char *) MAKE_PTR(bufHdr->data), 0, BLCKSZ);
status = smgrextend(bufHdr->bufsmgr, reln,
(char *) MAKE_PTR(bufHdr->data));
}

View File

@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.11 1997/09/08 21:46:52 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.12 1997/09/18 20:21:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -228,7 +228,7 @@ InitLocalBuffer(void)
*/
LocalBufferDescriptors =
(BufferDesc *) malloc(sizeof(BufferDesc) * NLocBuffer);
memset(LocalBufferDescriptors, 0, sizeof(BufferDesc) * NLocBuffer);
MemSet(LocalBufferDescriptors, 0, sizeof(BufferDesc) * NLocBuffer);
nextFreeLocalBuf = 0;
for (i = 0; i < NLocBuffer; i++)
@@ -246,7 +246,7 @@ InitLocalBuffer(void)
LocalRefCount =
(long *) malloc(sizeof(long) * NLocBuffer);
memset(LocalRefCount, 0, sizeof(long) * NLocBuffer);
MemSet(LocalRefCount, 0, sizeof(long) * NLocBuffer);
}
/*
@@ -283,7 +283,7 @@ LocalBufferSync(void)
}
}
memset(LocalRefCount, 0, sizeof(long) * NLocBuffer);
MemSet(LocalRefCount, 0, sizeof(long) * NLocBuffer);
nextFreeLocalBuf = 0;
}
@@ -301,6 +301,6 @@ ResetLocalBufferPool(void)
buf->buf_id = -i - 2;
}
memset(LocalRefCount, 0, sizeof(long) * NLocBuffer);
MemSet(LocalRefCount, 0, sizeof(long) * NLocBuffer);
nextFreeLocalBuf = 0;
}

View File

@@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Id: fd.c,v 1.25 1997/09/08 21:46:54 momjian Exp $
* $Id: fd.c,v 1.26 1997/09/18 20:21:24 momjian Exp $
*
* NOTES:
*
@@ -423,7 +423,7 @@ AllocateVfd()
for (i = SizeVfdCache; i < 2 * SizeVfdCache; i++)
{
memset((char *) &(VfdCache[i]), 0, sizeof(VfdCache[0]));
MemSet((char *) &(VfdCache[i]), 0, sizeof(VfdCache[0]));
VfdCache[i].nextFree = i + 1;
VfdCache[i].fd = VFD_CLOSED;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.15 1997/09/18 14:20:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.16 1997/09/18 20:21:26 momjian Exp $
*
* NOTES
*
@@ -90,7 +90,7 @@ PrivateMemoryCreate(IpcMemoryKey memKey,
IpcPrivateMem[memid].memptr = malloc(size);
if (IpcPrivateMem[memid].memptr == NULL)
elog(WARN, "PrivateMemoryCreate: not enough memory to malloc");
memset(IpcPrivateMem[memid].memptr, 0, size); /* XXX PURIFY */
MemSet(IpcPrivateMem[memid].memptr, 0, size); /* XXX PURIFY */
return (memid++);
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.13 1997/09/08 21:47:09 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.14 1997/09/18 20:21:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -226,7 +226,7 @@ InitShmem(unsigned int key, unsigned int size)
* there is an entry there, someone else created the table. Otherwise,
* we did and we have to initialize it.
*/
memset(item.key, 0, BTABLE_KEYSIZE);
MemSet(item.key, 0, BTABLE_KEYSIZE);
strncpy(item.key, "BindingTable", BTABLE_KEYSIZE);
result = (BindingEnt *)
@@ -407,7 +407,7 @@ ShmemPIDLookup(int pid, SHMEM_OFFSET *locationPtr)
bool found;
Assert(BindingTable);
memset(item.key, 0, BTABLE_KEYSIZE);
MemSet(item.key, 0, BTABLE_KEYSIZE);
sprintf(item.key, "PID %d", pid);
SpinAcquire(BindingLock);
@@ -455,7 +455,7 @@ ShmemPIDDestroy(int pid)
Assert(BindingTable);
memset(item.key, 0, BTABLE_KEYSIZE);
MemSet(item.key, 0, BTABLE_KEYSIZE);
sprintf(item.key, "PID %d", pid);
SpinAcquire(BindingLock);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.15 1997/09/18 14:20:22 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.16 1997/09/18 20:21:35 momjian Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
@@ -293,7 +293,7 @@ LockTabInit(char *tabName,
*/
if (!found)
{
memset(ltable->ctl, 0, sizeof(LOCKCTL));
MemSet(ltable->ctl, 0, sizeof(LOCKCTL));
ltable->ctl->masterLock = LockMgrLock;
ltable->ctl->tableId = NumTables;
}
@@ -518,8 +518,8 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
{
lock->mask = 0;
ProcQueueInit(&(lock->waitProcs));
memset((char *) lock->holders, 0, sizeof(int) * MAX_LOCKTYPES);
memset((char *) lock->activeHolders, 0, sizeof(int) * MAX_LOCKTYPES);
MemSet((char *) lock->holders, 0, sizeof(int) * MAX_LOCKTYPES);
MemSet((char *) lock->activeHolders, 0, sizeof(int) * MAX_LOCKTYPES);
lock->nHolding = 0;
lock->nActive = 0;
@@ -541,7 +541,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
* word alignment and ensures hashing consistency).
* ------------------
*/
memset(&item, 0, XID_TAGSIZE); /* must clear padding, needed */
MemSet(&item, 0, XID_TAGSIZE); /* must clear padding, needed */
TransactionIdStore(myXid, &item.tag.xid);
item.tag.lock = MAKE_OFFSET(lock);
#if 0
@@ -571,7 +571,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
XID_PRINT("LockAcquire: queueing XidEnt", result);
ProcAddLock(&result->queue);
result->nHolding = 0;
memset((char *) result->holders, 0, sizeof(int) * MAX_LOCKTYPES);
MemSet((char *) result->holders, 0, sizeof(int) * MAX_LOCKTYPES);
}
/* ----------------
@@ -683,7 +683,7 @@ LockResolveConflicts(LOCKTAB *ltable,
* word alignment and ensures hashing consistency.
* ------------------
*/
memset(&item, 0, XID_TAGSIZE);
MemSet(&item, 0, XID_TAGSIZE);
TransactionIdStore(xid, &item.tag.xid);
item.tag.lock = MAKE_OFFSET(lock);
#if 0
@@ -705,7 +705,7 @@ LockResolveConflicts(LOCKTAB *ltable,
* the lock stats.
* ---------------
*/
memset(result->holders, 0, nLockTypes * sizeof(*(lock->holders)));
MemSet(result->holders, 0, nLockTypes * sizeof(*(lock->holders)));
result->nHolding = 0;
}
@@ -951,7 +951,7 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
* word alignment and ensures hashing consistency).
* ------------------
*/
memset(&item, 0, XID_TAGSIZE);
MemSet(&item, 0, XID_TAGSIZE);
TransactionIdStore(GetCurrentTransactionId(), &item.tag.xid);
item.tag.lock = MAKE_OFFSET(lock);

View File

@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.7 1997/09/08 21:47:29 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.8 1997/09/18 20:21:38 momjian Exp $
*
* NOTES:
* (1) The lock.c module assumes that the caller here is doing
@@ -128,7 +128,7 @@ MultiLockReln(LockInfo linfo, LOCKT lockt)
* LOCKTAG has two bytes of padding, unfortunately. The hash function
* will return miss if the padding bytes aren't zero'd.
*/
memset(&tag, 0, sizeof(tag));
MemSet(&tag, 0, sizeof(tag));
tag.relId = linfo->lRelId.relId;
tag.dbId = linfo->lRelId.dbId;
return (MultiAcquire(MultiTableId, &tag, lockt, RELN_LEVEL));
@@ -151,7 +151,7 @@ MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
* LOCKTAG has two bytes of padding, unfortunately. The hash function
* will return miss if the padding bytes aren't zero'd.
*/
memset(&tag, 0, sizeof(tag));
MemSet(&tag, 0, sizeof(tag));
tag.relId = linfo->lRelId.relId;
tag.dbId = linfo->lRelId.dbId;
@@ -173,7 +173,7 @@ MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
* LOCKTAG has two bytes of padding, unfortunately. The hash function
* will return miss if the padding bytes aren't zero'd.
*/
memset(&tag, 0, sizeof(tag));
MemSet(&tag, 0, sizeof(tag));
/* ----------------------------
@@ -247,7 +247,7 @@ MultiAcquire(LockTableId tableId,
* for the lower levels. Always start from the highest level and go
* to the lowest level.
*/
memset(tmpTag, 0, sizeof(*tmpTag));
MemSet(tmpTag, 0, sizeof(*tmpTag));
tmpTag->relId = tag->relId;
tmpTag->dbId = tag->dbId;
@@ -319,7 +319,7 @@ MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
* zero'd.
* ------------------
*/
memset(&tag, 0, sizeof(LOCKTAG));
MemSet(&tag, 0, sizeof(LOCKTAG));
tag.relId = linfo->lRelId.relId;
tag.dbId = linfo->lRelId.dbId;
@@ -345,7 +345,7 @@ MultiReleaseReln(LockInfo linfo, LOCKT lockt)
* zero'd.
* ------------------
*/
memset(&tag, 0, sizeof(LOCKTAG));
MemSet(&tag, 0, sizeof(LOCKTAG));
tag.relId = linfo->lRelId.relId;
tag.dbId = linfo->lRelId.dbId;
@@ -401,7 +401,7 @@ MultiRelease(LockTableId tableId,
* Must zero out the tag to set padding byes to zero and ensure hashing
* consistency.
*/
memset(tmpTag, 0, sizeof(*tmpTag));
MemSet(tmpTag, 0, sizeof(*tmpTag));
tmpTag->relId = tag->relId;
tmpTag->dbId = tag->dbId;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.21 1997/09/08 21:47:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.22 1997/09/18 20:21:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,7 +46,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.21 1997/09/08 21:47:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.22 1997/09/18 20:21:39 momjian Exp $
*/
#include <sys/time.h>
#include <unistd.h>
@@ -217,7 +217,7 @@ InitProcess(IPCKey key)
* ProcStructLock to 1 as we have acquired this spinlock above but
* didn't record it since we didn't have MyProc until now.
*/
memset(MyProc->sLocks, 0, sizeof(MyProc->sLocks));
MemSet(MyProc->sLocks, 0, sizeof(MyProc->sLocks));
MyProc->sLocks[ProcStructLock] = 1;
@@ -271,7 +271,7 @@ InitProcess(IPCKey key)
* this initialization is forever botched
* ----------------
*/
memset(MyProc->sLocks, 0, MAX_SPINS * sizeof(*MyProc->sLocks));
MemSet(MyProc->sLocks, 0, MAX_SPINS * sizeof(*MyProc->sLocks));
/* -------------------------
* Install ourselves in the binding table. The name to
@@ -514,7 +514,7 @@ ProcSleep(PROC_QUEUE *queue,
* to 0.
* --------------
*/
memset(&timeval, 0, sizeof(struct itimerval));
MemSet(&timeval, 0, sizeof(struct itimerval));
timeval.it_value.tv_sec = DEADLOCK_TIMEOUT;
if (setitimer(ITIMER_REAL, &timeval, &dummy))

View File

@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.4 1997/09/08 02:29:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.5 1997/09/18 20:21:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,7 +40,7 @@ SingleLockReln(LockInfo linfo, LOCKT lockt, int action)
* LOCKTAG has two bytes of padding, unfortunately. The hash function
* will return miss if the padding bytes aren't zero'd.
*/
memset(&tag, 0, sizeof(tag));
MemSet(&tag, 0, sizeof(tag));
tag.relId = linfo->lRelId.relId;
tag.dbId = linfo->lRelId.dbId;
BlockIdSet(&(tag.tupleId.ip_blkid), InvalidBlockNumber);
@@ -72,7 +72,7 @@ SingleLockPage(LockInfo linfo,
* LOCKTAG has two bytes of padding, unfortunately. The hash function
* will return miss if the padding bytes aren't zero'd.
*/
memset(&tag, 0, sizeof(tag));
MemSet(&tag, 0, sizeof(tag));
tag.relId = linfo->lRelId.relId;
tag.dbId = linfo->lRelId.dbId;
BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.10 1997/09/08 02:29:22 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.11 1997/09/18 20:21:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -202,7 +202,7 @@ PageGetTempPage(Page page, Size specialSize)
/* clear out the middle */
size = (pageSize - sizeof(PageHeaderData)) + sizeof(ItemIdData);
size -= DOUBLEALIGN(specialSize);
memset((char *) &(thdr->pd_linp[0]), 0, size);
MemSet((char *) &(thdr->pd_linp[0]), 0, size);
/* set high, low water marks */
thdr->pd_lower = sizeof(PageHeaderData) - sizeof(ItemIdData);
@@ -311,7 +311,7 @@ PageRepairFragmentation(Page page)
{ /* nused != 0 */
itemidbase = (struct itemIdSortData *)
palloc(sizeof(struct itemIdSortData) * nused);
memset((char *) itemidbase, 0, sizeof(struct itemIdSortData) * nused);
MemSet((char *) itemidbase, 0, sizeof(struct itemIdSortData) * nused);
itemidptr = itemidbase;
for (i = 0; i < nline; i++)
{

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.21 1997/09/08 21:47:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.22 1997/09/18 20:21:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -96,7 +96,7 @@ mdinit()
if (Md_fdvec == (MdfdVec *) NULL)
return (SM_FAIL);
memset(Md_fdvec, 0, Nfds * sizeof(MdfdVec));
MemSet(Md_fdvec, 0, Nfds * sizeof(MdfdVec));
/* Set free list */
for (i = 0; i < Nfds; i++)
@@ -362,7 +362,7 @@ mdread(Relation reln, BlockNumber blocknum, char *buffer)
{
if (nbytes == 0)
{
memset(buffer, 0, BLCKSZ);
MemSet(buffer, 0, BLCKSZ);
}
else
{
@@ -695,7 +695,7 @@ _fdvec_alloc()
oldcxt = MemoryContextSwitchTo(MdCxt);
nvec = (MdfdVec *) palloc(Nfds * sizeof(MdfdVec));
memset(nvec, 0, Nfds * sizeof(MdfdVec));
MemSet(nvec, 0, Nfds * sizeof(MdfdVec));
memmove(nvec, (char *) Md_fdvec, CurFd * sizeof(MdfdVec));
pfree(Md_fdvec);

View File

@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/Attic/mm.c,v 1.6 1997/09/08 02:29:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/Attic/mm.c,v 1.7 1997/09/18 20:21:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -141,7 +141,7 @@ mminit()
if (IsPostmaster)
{
memset(mmcacheblk, 0, mmsize);
MemSet(mmcacheblk, 0, mmsize);
SpinRelease(MMCacheLock);
return (SM_SUCCESS);
}
@@ -407,7 +407,7 @@ mmread(Relation reln, BlockNumber blocknum, char *buffer)
{
/* reading nonexistent pages is defined to fill them with zeroes */
SpinRelease(MMCacheLock);
memset(buffer, 0, BLCKSZ);
MemSet(buffer, 0, BLCKSZ);
return (SM_SUCCESS);
}