1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Make functions static where possible, enclose unused functions in #ifdef NOT_USED.

This commit is contained in:
Bruce Momjian
1997-08-19 21:40:56 +00:00
parent b992e200b8
commit 1d8bbfd2e7
186 changed files with 1114 additions and 1048 deletions

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: buf_internals.h,v 1.13 1997/08/03 02:38:25 momjian Exp $
* $Id: buf_internals.h,v 1.14 1997/08/19 21:39:41 momjian Exp $
*
* NOTE
* If BUFFERPAGE0 is defined, then 0 will be used as a
@@ -63,7 +63,7 @@ struct buftag{
(a)->blockNum = xx_blockNum;\
(a)->relId = RelationGetLRelId(xx_reln); \
}
#ifdef NOT_USED
#define COPY_BUFFERTAG(a,b)\
{ \
(a)->blockNum = (b)->blockNum;\
@@ -73,7 +73,7 @@ struct buftag{
#define EQUAL_BUFFERTAG(a,b) \
(((a)->blockNum == (b)->blockNum) &&\
(OID_Equal((a)->relId.relId,(b)->relId.relId)))
#endif
#define BAD_BUFFER_ID(bid) ((bid<1) || (bid>(NBuffers)))
#define INVALID_DESCRIPTOR (-3)
@@ -199,17 +199,14 @@ extern void AddBufferToFreelist(BufferDesc *bf);
extern void PinBuffer(BufferDesc *buf);
extern void PinBuffer_Debug(char *file, int line, BufferDesc *buf);
extern void UnpinBuffer(BufferDesc *buf);
extern void UnpinBuffer_Debug(char *file, int line, BufferDesc *buf);
extern BufferDesc *GetFreeBuffer(void);
extern void InitFreeList(bool init);
extern void DBG_FreeListCheck(int nfree);
/* buf_table.c */
extern void InitBufTable(void);
extern BufferDesc *BufTableLookup(BufferTag *tagPtr);
extern bool BufTableDelete(BufferDesc *buf);
extern bool BufTableInsert(BufferDesc *buf);
extern void DBG_LookupListCheck(int nlookup);
/* bufmgr.c */
extern BufferDesc *BufferDescriptors;

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: bufmgr.h,v 1.10 1997/03/28 07:06:53 scrappy Exp $
* $Id: bufmgr.h,v 1.11 1997/08/19 21:39:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,12 +74,7 @@ extern int ShowPinTrace;
extern Buffer RelationGetBufferWithBuffer(Relation relation,
BlockNumber blockNumber, Buffer buffer);
extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum);
extern Buffer ReadBuffer_Debug(char *file, int line, Relation reln,
BlockNumber blockNum);
extern int WriteBuffer(Buffer buffer);
extern void WriteBuffer_Debug(char *file, int line, Buffer buffer);
extern void DirtyBufferCopy(Oid dbid, Oid relid, BlockNumber blkno,
char *dest);
extern int WriteNoReleaseBuffer(Buffer buffer);
extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation,
BlockNumber blockNum);
@@ -100,17 +95,9 @@ extern void DropBuffers(Oid dbid);
extern void PrintBufferDescs(void);
extern void PrintPinnedBufs(void);
extern int BufferShmemSize(void);
extern void BufferPoolBlowaway(void);
extern void IncrBufferRefCount(Buffer buffer);
extern int ReleaseBuffer(Buffer buffer);
extern void IncrBufferRefCount_Debug(char *file, int line, Buffer buffer);
extern void ReleaseBuffer_Debug(char *file, int line, Buffer buffer);
extern int ReleaseAndReadBuffer_Debug(char *file,
int line,
Buffer buffer,
Relation relation,
BlockNumber blockNum);
extern void BufferRefCountReset(int *refcountsave);
extern void BufferRefCountRestore(int *refcountsave);
extern int SetBufferWriteMode (int mode);

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: bufpage.h,v 1.7 1996/11/05 06:10:57 scrappy Exp $
* $Id: bufpage.h,v 1.8 1997/08/19 21:39:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -253,8 +253,6 @@ extern void PageRepairFragmentation(Page page);
extern Size PageGetFreeSpace(Page page);
extern void PageManagerModeSet(PageManagerMode mode);
extern void PageIndexTupleDelete(Page page, OffsetNumber offset);
extern void PageIndexTupleDeleteAdjustLinePointers(PageHeader phdr,
char *location, Size size);
#endif /* BUFPAGE_H */

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: fd.h,v 1.7 1997/08/18 02:15:04 momjian Exp $
* $Id: fd.h,v 1.8 1997/08/19 21:39:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -60,7 +60,6 @@ struct pgstat { /* just the fields we need from stat structure */
/*
* prototypes for functions in fd.c
*/
extern void FileInvalidate(File file);
extern File FileNameOpenFile(FileName fileName, int fileFlags, int fileMode);
extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode);
extern void FileClose(File file);
@@ -68,7 +67,6 @@ extern void FileUnlink(File file);
extern int FileRead(File file, char *buffer, int amount);
extern int FileWrite(File file, char *buffer, int amount);
extern long FileSeek(File file, long offset, int whence);
extern long FileTell(File file);
extern int FileTruncate(File file, int offset);
extern int FileSync(File file);
extern int FileNameUnlink(char *filename);

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: ipc.h,v 1.16 1997/03/12 21:12:27 scrappy Exp $
* $Id: ipc.h,v 1.17 1997/08/19 21:39:50 momjian Exp $
*
* NOTES
* This file is very architecture-specific. This stuff should actually
@@ -92,7 +92,6 @@ extern int on_exitpg(void (*function)(), caddr_t arg);
extern IpcSemaphoreId IpcSemaphoreCreate(IpcSemaphoreKey semKey,
int semNum, int permission, int semStartValue,
int removeOnExit, int *status);
extern void IpcSemaphoreSet(int semId, int semno, int value);
extern void IpcSemaphoreKill(IpcSemaphoreKey key);
extern void IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock);
extern void IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock);
@@ -101,7 +100,6 @@ extern int IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem);
extern IpcMemoryId IpcMemoryCreate(IpcMemoryKey memKey, uint32 size,
int permission);
extern IpcMemoryId IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size);
extern void IpcMemoryDetach(int status, char *shmaddr);
extern char *IpcMemoryAttach(IpcMemoryId memId);
extern void IpcMemoryKill(IpcMemoryKey memKey);
extern void CreateAndInitSLockMemory(IPCKey key);

View File

@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: large_object.h,v 1.3 1996/11/05 06:10:58 scrappy Exp $
* $Id: large_object.h,v 1.4 1997/08/19 21:39:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,7 +49,6 @@ extern LargeObjectDesc *inv_create(int flags);
extern LargeObjectDesc *inv_open(Oid lobjId, int flags);
extern void inv_close(LargeObjectDesc *obj_desc);
extern int inv_destroy(Oid lobjId);
extern int inv_stat(LargeObjectDesc *obj_desc, struct pgstat *stbuf);
extern int inv_seek(LargeObjectDesc *obj_desc, int offset, int whence);
extern int inv_tell(LargeObjectDesc *obj_desc);
extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes);

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: lmgr.h,v 1.4 1996/11/08 06:02:18 momjian Exp $
* $Id: lmgr.h,v 1.5 1997/08/19 21:39:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,19 +38,13 @@ typedef LockInfoData *LockInfo;
extern LRelId RelationGetLRelId(Relation relation);
extern Oid LRelIdGetDatabaseId(LRelId lRelId);
extern Oid LRelIdGetRelationId(LRelId lRelId);
extern bool DatabaseIdIsMyDatabaseId(Oid databaseId);
extern bool LRelIdContainsMyDatabaseId(LRelId lRelId);
extern void RelationInitLockInfo(Relation relation);
extern void RelationDiscardLockInfo(Relation relation);
extern void RelationSetLockForDescriptorOpen(Relation relation);
extern void RelationSetLockForRead(Relation relation);
extern void RelationUnsetLockForRead(Relation relation);
extern void RelationSetLockForWrite(Relation relation);
extern void RelationUnsetLockForWrite(Relation relation);
extern void RelationSetLockForTupleRead(Relation relation,
ItemPointer itemPointer);
/* used in vaccum.c */
extern void RelationSetLockForWritePage(Relation relation,
@@ -69,9 +63,6 @@ extern void RelationSetRIntentLock(Relation relation);
extern void RelationUnsetRIntentLock(Relation relation);
extern void RelationSetWIntentLock(Relation relation);
extern void RelationUnsetWIntentLock(Relation relation);
extern void RelationSetLockForExtend(Relation relation);
extern void RelationUnsetLockForExtend(Relation relation);
extern void LRelIdAssign(LRelId *lRelId, Oid dbId, Oid relId);
/* single.c */
extern bool SingleLockReln(LockInfo linfo, LOCKT lockt, int action);

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: lock.h,v 1.4 1997/02/12 05:25:13 scrappy Exp $
* $Id: lock.h,v 1.5 1997/08/19 21:39:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -199,12 +199,9 @@ extern void InitLocks(void);
extern void LockDisable(int status);
extern LockTableId LockTabInit(char *tabName, MASK *conflictsP, int *prioP,
int ntypes);
extern LockTableId LockTabRename(LockTableId tableId);
extern bool LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt);
extern int LockResolveConflicts(LOCKTAB *ltable, LOCK *lock, LOCKT lockt,
TransactionId xid);
extern int WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock,
LOCKT lockt);
extern bool LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt);
extern void GrantLock(LOCK *lock, LOCKT lockt);
extern bool LockReleaseAll(LockTableId tableId, SHM_QUEUE *lockQueue);

View File

@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: multilev.h,v 1.2 1996/11/05 06:11:01 scrappy Exp $
* $Id: multilev.h,v 1.3 1997/08/19 21:39:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,11 +53,6 @@ extern LockTableId InitMultiLevelLockm(void);
extern bool MultiLockReln(LockInfo linfo, LOCKT lockt);
extern bool MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt);
extern bool MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt);
extern bool MultiAcquire(LockTableId tableId, LOCKTAG *tag, LOCKT lockt,
LOCK_LEVEL level);
extern bool MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt);
extern bool MultiReleaseReln(LockInfo linfo, LOCKT lockt);
extern bool MultiRelease(LockTableId tableId, LOCKTAG *tag, LOCKT lockt,
LOCK_LEVEL level);
#endif /* MULTILEV_H */

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: proc.h,v 1.4 1997/02/14 04:18:51 momjian Exp $
* $Id: proc.h,v 1.5 1997/08/19 21:39:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -99,15 +99,11 @@ extern bool ProcRemove(int pid);
/* extern bool ProcKill(int exitStatus, int pid); */
/* make static in storage/lmgr/proc.c -- jolly */
extern PROC_QUEUE *ProcQueueAlloc(char *name);
extern void ProcQueueInit(PROC_QUEUE *queue);
extern int ProcSleep(PROC_QUEUE *queue, SPINLOCK spinlock, int token,
int prio, LOCK *lock);
extern PROC *ProcWakeup(PROC *proc, int errType);
extern int ProcGetId(void);
extern int ProcLockWakeup(PROC_QUEUE *queue, char * ltable, char * lock);
extern void ProcAddLock(SHM_QUEUE *elem);
extern void HandleDeadLock(int sig);
extern void ProcReleaseSpins(PROC *proc);
extern void ProcFreeAllSemaphores(void);

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: shmem.h,v 1.4 1996/11/27 07:32:10 vadim Exp $
* $Id: shmem.h,v 1.5 1997/08/19 21:40:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -94,10 +94,8 @@ typedef struct {
* prototypes for functions in shmqueue.c
*/
extern void SHMQueueInit(SHM_QUEUE *queue);
extern bool SHMQueueIsDetached(SHM_QUEUE *queue);
extern void SHMQueueElemInit(SHM_QUEUE *queue);
extern void SHMQueueDelete(SHM_QUEUE *queue);
extern void SHMQueueInsertHD(SHM_QUEUE *queue, SHM_QUEUE *elem);
extern void SHMQueueInsertTL(SHM_QUEUE *queue, SHM_QUEUE *elem);
extern void SHMQueueFirst(SHM_QUEUE *queue, Pointer *nextPtrPtr,
SHM_QUEUE *nextQueue);

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: smgr.h,v 1.6 1996/11/27 07:33:42 vadim Exp $
* $Id: smgr.h,v 1.7 1997/08/19 21:40:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,7 +23,6 @@
#define DEFAULT_SMGR 0
extern int smgrinit(void);
extern void smgrshutdown(int dummy);
extern int smgrcreate(int16 which, Relation reln);
extern int smgrunlink(int16 which, Relation reln);
extern int smgrextend(int16 which, Relation reln, char *buffer);
@@ -40,7 +39,6 @@ extern int smgrblindwrt(int16 which, char *dbname, char *relname, Oid dbid,
extern int smgrnblocks(int16 which, Relation reln);
extern int smgrtruncate(int16 which, Relation reln, int nblocks);
extern int smgrcommit(void);
extern int smgrabort(void);
extern bool smgriswo(int16 smgrno);

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: spin.h,v 1.2 1996/11/05 06:11:08 scrappy Exp $
* $Id: spin.h,v 1.3 1997/08/19 21:40:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,11 +28,8 @@
typedef int SPINLOCK;
extern bool CreateSpinlocks(IPCKey key);
extern bool AttachSpinLocks(IPCKey key);
extern bool InitSpinLocks(int init, IPCKey key);
extern void SpinAcquire(SPINLOCK lock);
extern void SpinRelease(SPINLOCK lock);
extern bool SpinIsLocked(SPINLOCK lock);
#endif /* SPIN_H */