]> granicus.if.org Git - postgresql/commitdiff
Fix macros that were not properly surrounded by parens or braces.
authorBruce Momjian <bruce@momjian.us>
Mon, 15 Jun 1998 18:40:05 +0000 (18:40 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 15 Jun 1998 18:40:05 +0000 (18:40 +0000)
29 files changed:
src/backend/access/common/scankey.c
src/backend/access/index/indexam.c
src/backend/executor/nodeMergejoin.c
src/backend/optimizer/path/xfunc.c
src/backend/storage/buffer/freelist.c
src/backend/tcop/utility.c
src/backend/tioga/Arr_TgRecipe.h
src/backend/tioga/Varray.h
src/backend/utils/adt/date.c
src/backend/utils/adt/dt.c
src/backend/utils/cache/catcache.c
src/backend/utils/cache/relcache.c
src/backend/utils/mmgr/portalmem.c
src/backend/utils/sort/psort.c
src/bin/psql/psqlHelp.h
src/include/access/attnum.h
src/include/access/heapam.h
src/include/access/itup.h
src/include/c.h
src/include/executor/execdebug.h
src/include/storage/block.h
src/include/storage/buf_internals.h
src/include/storage/bufmgr.h
src/include/storage/bufpage.h
src/include/storage/itemid.h
src/include/storage/itemptr.h
src/include/storage/lock.h
src/include/storage/s_lock.h
src/include/utils/exc.h

index 130a80ae6d389c3cbca89c865c5d144f72e56d1e..680d8aeec5272e7e0a26acc675a8e3c8184b2dd2 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.11 1998/01/15 19:41:46 pgsql Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.12 1998/06/15 18:39:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
  *             True iff the scan key entry is legal.
  */
 #define ScanKeyEntryIsLegal(entry) \
-       ((bool) (AssertMacro(PointerIsValid(entry)) && \
-                        AttributeNumberIsValid(entry->sk_attno)))
+( \
+       AssertMacro(PointerIsValid(entry)), \
+       AttributeNumberIsValid((entry)->sk_attno) \
+)
 
 /*
  * ScanKeyEntrySetIllegal --
index 17fb43b4362b1ae546f41391b54af147672a8c26..e6af2ff9e6a536cf2d73f2753c26dd393ed887f6 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.21 1998/02/26 12:07:10 vadim Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.22 1998/06/15 18:39:23 momjian Exp $
  *
  * INTERFACE ROUTINES
  *             index_open              - open an index relation by relationId
  * ----------------------------------------------------------------
  */
 #define RELATION_CHECKS \
-Assert(RelationIsValid(relation)); \
-                Assert(PointerIsValid(relation->rd_am))
+( \
+       AssertMacro(RelationIsValid(relation)), \
+       AssertMacro(PointerIsValid(relation->rd_am)) \
+)
 
 #define SCAN_CHECKS \
-        Assert(IndexScanIsValid(scan)); \
-                Assert(RelationIsValid(scan->relation)); \
-                Assert(PointerIsValid(scan->relation->rd_am))
+( \
+       AssertMacro(IndexScanIsValid(scan)), \
+       AssertMacro(RelationIsValid(scan->relation)), \
+       AssertMacro(PointerIsValid(scan->relation->rd_am)) \
+)
 
 #define GET_REL_PROCEDURE(x,y) \
-                procedure = relation->rd_am->y; \
-                if (! RegProcedureIsValid(procedure)) \
-                elog(ERROR, "index_%s: invalid %s regproc", \
-                         CppAsString(x), CppAsString(y))
-
+( \
+       procedure = relation->rd_am->y, \
+       (!RegProcedureIsValid(procedure)) ? \
+               elog(ERROR, "index_%s: invalid %s regproc", \
+                       CppAsString(x), CppAsString(y)) \
+       : (void)NULL \
+)
+       
 #define GET_SCAN_PROCEDURE(x,y) \
-                procedure = scan->relation->rd_am->y; \
-                if (! RegProcedureIsValid(procedure)) \
-                elog(ERROR, "index_%s: invalid %s regproc", \
-                         CppAsString(x), CppAsString(y))
+( \
+       procedure = scan->relation->rd_am->y, \
+       (!RegProcedureIsValid(procedure)) ? \
+               elog(ERROR, "index_%s: invalid %s regproc", \
+                       CppAsString(x), CppAsString(y)) \
+       : (void)NULL \
+)
 
 
 /* ----------------------------------------------------------------
index 211160b9e4a2210e8e60742139057049a06302dd..0525f93296db7f9b020ff57be666245f85b30fee 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.14 1998/02/27 16:11:28 vadim Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.15 1998/06/15 18:39:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 static bool MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext);
 
 #define MarkInnerTuple(innerTupleSlot, mergestate) \
-{ \
-       ExecStoreTuple(heap_copytuple(innerTupleSlot->val), \
-                                  mergestate->mj_MarkedTupleSlot, \
+( \
+       ExecStoreTuple(heap_copytuple((innerTupleSlot)->val), \
+                                  (mergestate)->mj_MarkedTupleSlot, \
                                   InvalidBuffer, \
-                                  true); \
-}
+                                  true) \
+)
 
 /* ----------------------------------------------------------------
  *             MJFormOSortopI
index 3b77217481a8e7a0b5fbd158348cfbf512422bb9..935a2422f5214a3db68ff249e2a9860ce56060c7 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.13 1998/02/26 04:32:44 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.14 1998/06/15 18:39:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1424,9 +1424,12 @@ xfunc_LispRemove(LispValue foo, List bar)
 }
 
 #define Node_Copy(a, b, c, d) \
-       if (NodeCopy((Node)((a)->d), (Node*)&((b)->d), c) != true) { \
-                                                                                                               return false; \
-                                                                                                               }
+do { \
+       if (NodeCopy((Node)((a)->d), (Node*)&((b)->d), c) != true) \
+       { \
+               return false; \
+       } \
+} while(0)
 
 /*
  ** xfunc_copyrel --
index dcfebe60142bdf2510dfaea5415b0f63a5253d7b..e24d36cb8d422ca51dc2342e5dea94790b99fc49 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.9 1998/01/07 21:04:52 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.10 1998/06/15 18:39:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,14 +40,18 @@ static BufferDesc *SharedFreeList;
 extern SPINLOCK BufMgrLock;
 
 #define IsInQueue(bf) \
-       Assert((bf->freeNext != INVALID_DESCRIPTOR));\
-       Assert((bf->freePrev != INVALID_DESCRIPTOR));\
-       Assert((bf->flags & BM_FREE))
+( \
+       AssertMacro((bf->freeNext != INVALID_DESCRIPTOR)), \
+       AssertMacro((bf->freePrev != INVALID_DESCRIPTOR)), \
+       AssertMacro((bf->flags & BM_FREE)) \
+)
 
 #define NotInQueue(bf) \
-       Assert((bf->freeNext == INVALID_DESCRIPTOR));\
-       Assert((bf->freePrev == INVALID_DESCRIPTOR));\
-       Assert(! (bf->flags & BM_FREE))
+( \
+       AssertMacro((bf->freeNext == INVALID_DESCRIPTOR)), \
+       AssertMacro((bf->freePrev == INVALID_DESCRIPTOR)), \
+       AssertMacro(! (bf->flags & BM_FREE)) \
+)
 
 
 /*
index 20eb12d7f512cad23741a9c0851d6641d968148d..83ec8c9fd1fd5238d34d8ecf2d0ad2927fb354b3 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.39 1998/06/04 17:26:48 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.40 1998/06/15 18:39:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -67,13 +67,18 @@ extern const char **ps_status;      /* from postgres.c */
  *             processing within an aborted transaction block.
  * ----------------
  */
+ /* we have to use IF because of the 'break' */
 #define CHECK_IF_ABORTED() \
-       if (IsAbortedTransactionBlockState()) { \
+if (1) \
+{ \
+       if (IsAbortedTransactionBlockState()) \
+       { \
                elog(NOTICE, "(transaction aborted): %s", \
                         "queries ignored until END"); \
                commandTag = "*ABORT STATE*"; \
                break; \
        } \
+} else
 
 /* ----------------
  *             general utility function invoker
index 9cfec9585e94b653137b3b42c8349d7d06263a6c..ddfcf8ce382bc4979a5e1cb19f079e97af14ba96 100644 (file)
@@ -43,8 +43,10 @@ typedef struct Arr_TgString
   (Arr_TgString *) NewVarray(ARR_TgString_INITIAL_SIZE, sizeof(TgString))
 
 #define enlargeArr_TgString(A, I) \
-  (A)->size += (I); \
-  (A)->val = (TgString *) realloc((A)->val, (A)->valSize * (A)->size)
+( \
+  (A)->size += (I), \
+  (A)->val = (TgString *) realloc((A)->val, (A)->valSize * (A)->size) \
+)
 
 #define addArr_TgString(A, V) \
   AppendVarray((Varray *) (A), (void *) (V), (CopyingFunct) copyTgString)
@@ -79,8 +81,10 @@ typedef struct Arr_TgElementPtr
   (Arr_TgElementPtr *) NewVarray(ARR_TgElementPtr_INITIAL_SIZE, sizeof(TgElementPtr))
 
 #define enlargeArr_TgElementPtr(A, I) \
-  (A)->size += (I); \
-  (A)->val = (TgElementPtr *) realloc((A)->val, (A)->valSize * (A)->size)
+( \
+  (A)->size += (I), \
+  (A)->val = (TgElementPtr *) realloc((A)->val, (A)->valSize * (A)->size) \
+)
 
 #define addArr_TgElementPtr(A, V) \
   AppendVarray((Varray *) (A), (void *) (V), (CopyingFunct) copyTgElementPtr)
@@ -115,8 +119,10 @@ typedef struct Arr_TgNodePtr
   (Arr_TgNodePtr *) NewVarray(ARR_TgNodePtr_INITIAL_SIZE, sizeof(TgNodePtr))
 
 #define enlargeArr_TgNodePtr(A, I) \
-  (A)->size += (I); \
-  (A)->val = (TgNodePtr *) realloc((A)->val, (A)->valSize * (A)->size)
+( \
+  (A)->size += (I), \
+  (A)->val = (TgNodePtr *) realloc((A)->val, (A)->valSize * (A)->size) \
+)
 
 #define addArr_TgNodePtr(A, V) \
   AppendVarray((Varray *) (A), (void *) (V), (CopyingFunct) copyTgNodePtr)
index 496b04520ab82342bba0678856be1b48a4368d72..3b229ce462bc49e4f882d5cd877e4215e5e520bd 100644 (file)
@@ -23,9 +23,11 @@ typedef void (*CopyingFunct) (void *from, void *to);
 #define VARRAY_INITIAL_SIZE 32
 
 #define ENLARGE_VARRAY(ARRAY, INC) \
-  (ARRAY)->maxObj += (INC); \
+( \
+  (ARRAY)->maxObj += (INC), \
   (ARRAY)->val = (void *) realloc((ARRAY)->val, \
-                                                                 (ARRAY)->size * (ARRAY)->maxObj)
+                                                                 (ARRAY)->size * (ARRAY)->maxObj) \
+)
 
 #define VARRAY_NTH(VAL, SIZE, N) (((char *) (VAL)) + (SIZE) * (N))
 
index 6b7c24c5488edb085f60a4e1f2c1fbf3c8fa1aa4..0edd618656b9f00079b7b35879845bed4b5b0ac6 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.24 1998/02/26 04:36:57 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.25 1998/06/15 18:39:34 momjian Exp $
  *
  * NOTES
  *      This code is actually (almost) unused.
@@ -187,8 +187,11 @@ reltimeout(int32 time)
 }      /* reltimeout() */
 
 
-#define TMODULO(t,q,u) {q = (t / u); \
-                                               if (q != 0) t -= (q * u);}
+#define TMODULO(t,q,u) \
+do { \
+       q = (t / u); \
+       if (q != 0) t -= (q * u); \
+} while(0)
 
 static void
 reltime2tm(int32 time, struct tm * tm)
index ffbb71167de79ca80e49b2d9f98b36df359d4ac6..f7f18b559d22d7d6a1ec2921c15a842373714a4d 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.53 1998/05/09 22:38:18 thomas Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.54 1998/06/15 18:39:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -66,8 +66,12 @@ char    *days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
 /* TMODULO()
  * Macro to replace modf(), which is broken on some platforms.
  */
-#define TMODULO(t,q,u) {q = ((t < 0)? ceil(t / u): floor(t / u)); \
-                                               if (q != 0) t -= rint(q * u);}
+#define TMODULO(t,q,u) \
+do { \
+       q = ((t < 0)? ceil(t / u): floor(t / u)); \
+       if (q != 0) \
+               t -= rint(q * u); \
+} while(0)
 
 static void GetEpochTime(struct tm * tm);
 
index bb0adff86784046e4e3d0c5dec2203c775e488c8..47ce6a8b6ea7af669b671e50bf21191a6ddcca9b 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.27 1998/04/26 04:08:01 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.28 1998/06/15 18:39:40 momjian Exp $
  *
  * Notes:
  *             XXX This needs to use exception.h to handle recovery when
@@ -96,13 +96,17 @@ static long eqproc[] = {
  */
 #ifdef CACHEDEBUG
 #define CatalogCacheInitializeCache_DEBUG1 \
+do { \
        elog(DEBUG, "CatalogCacheInitializeCache: cache @%08lx", cache); \
        if (relation) \
                elog(DEBUG, "CatalogCacheInitializeCache: called w/relation(inval)"); \
        else \
                elog(DEBUG, "CatalogCacheInitializeCache: called w/relname %s", \
-                       cache->cc_relname)
+                       cache->cc_relname) \
+} while(0)
+                       
 #define CatalogCacheInitializeCache_DEBUG2 \
+do { \
                if (cache->cc_key[i] > 0) { \
                        elog(DEBUG, "CatalogCacheInitializeCache: load %d/%d w/%d, %d", \
                                i+1, cache->cc_nkeys, cache->cc_key[i], \
@@ -110,7 +114,9 @@ static long eqproc[] = {
                } else { \
                        elog(DEBUG, "CatalogCacheInitializeCache: load %d/%d w/%d", \
                                i+1, cache->cc_nkeys, cache->cc_key[i]); \
-               }
+               } \
+} while(0)
+
 #else
 #define CatalogCacheInitializeCache_DEBUG1
 #define CatalogCacheInitializeCache_DEBUG2
@@ -654,16 +660,20 @@ SystemCacheRelationFlushed(Oid relId)
  */
 #ifdef CACHEDEBUG
 #define InitSysCache_DEBUG1 \
-elog(DEBUG, "InitSysCache: rid=%d id=%d nkeys=%d size=%d\n", \
-        cp->relationId, cp->id, cp->cc_nkeys, cp->cc_size); \
-       for (i = 0; i < nkeys; i += 1) { \
-                                                                                elog(DEBUG, "InitSysCache: key=%d len=%d skey=[%d %d %d %d]\n", \
-                                                                                         cp->cc_key[i], cp->cc_klen[i], \
-                                                                                         cp->cc_skey[i].sk_flags, \
-                                                                                         cp->cc_skey[i].sk_attno, \
-                                                                                         cp->cc_skey[i].sk_procedure, \
-                                                                                         cp->cc_skey[i].sk_argument); \
-                                                                                         }
+do { \
+       elog(DEBUG, "InitSysCache: rid=%d id=%d nkeys=%d size=%d\n", \
+               cp->relationId, cp->id, cp->cc_nkeys, cp->cc_size); \
+       for (i = 0; i < nkeys; i += 1) \
+       { \
+               elog(DEBUG, "InitSysCache: key=%d len=%d skey=[%d %d %d %d]\n", \
+                        cp->cc_key[i], cp->cc_klen[i], \
+                        cp->cc_skey[i].sk_flags, \
+                        cp->cc_skey[i].sk_attno, \
+                        cp->cc_skey[i].sk_procedure, \
+                        cp->cc_skey[i].sk_argument); \
+       } \
+} while(0)
+                                                                                         
 #else
 #define InitSysCache_DEBUG1
 #endif
index 9776bcd9bffc8ebfa27bdb2b080a215b6cb52f02..3fe7de4c32196bcbd29b5c41dc1be8f131bf5065 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.38 1998/04/27 04:07:20 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.39 1998/06/15 18:39:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -157,86 +157,80 @@ typedef struct relnamecacheent
  * -----------------
  */
 #define RelationCacheInsert(RELATION)  \
-       {       RelIdCacheEnt *idhentry; RelNameCacheEnt *namehentry; \
-               char *relname; Oid reloid; bool found; \
-               relname = (RELATION->rd_rel->relname).data; \
-               namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
-                                                                                                  relname, \
-                                                                                                  HASH_ENTER, \
-                                                                                                  &found); \
-               if (namehentry == NULL) { \
-                       elog(FATAL, "can't insert into relation descriptor cache"); \
-                 } \
-               if (found && !IsBootstrapProcessingMode()) { \
-                       /* used to give notice -- now just keep quiet */ ; \
-                 } \
-               namehentry->reldesc = RELATION; \
-               reloid = RELATION->rd_id; \
-               idhentry = (RelIdCacheEnt*)hash_search(RelationIdCache, \
-                                                                                          (char *)&reloid, \
+do { \
+       RelIdCacheEnt *idhentry; RelNameCacheEnt *namehentry; \
+       char *relname; Oid reloid; bool found; \
+       relname = (RELATION->rd_rel->relname).data; \
+       namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
+                                                                                          relname, \
                                                                                           HASH_ENTER, \
                                                                                           &found); \
-               if (idhentry == NULL) { \
-                       elog(FATAL, "can't insert into relation descriptor cache"); \
-                 } \
-               if (found && !IsBootstrapProcessingMode()) { \
-                       /* used to give notice -- now just keep quiet */ ; \
-                 } \
-               idhentry->reldesc = RELATION; \
-       }
+       if (namehentry == NULL) \
+               elog(FATAL, "can't insert into relation descriptor cache"); \
+       if (found && !IsBootstrapProcessingMode()) \
+               /* used to give notice -- now just keep quiet */ ; \
+       namehentry->reldesc = RELATION; \
+       reloid = RELATION->rd_id; \
+       idhentry = (RelIdCacheEnt*)hash_search(RelationIdCache, \
+                                                                                  (char *)&reloid, \
+                                                                                  HASH_ENTER, \
+                                                                                  &found); \
+       if (idhentry == NULL) \
+               elog(FATAL, "can't insert into relation descriptor cache"); \
+       if (found && !IsBootstrapProcessingMode()) \
+               /* used to give notice -- now just keep quiet */ ; \
+       idhentry->reldesc = RELATION; \
+} while(0)
+
 #define RelationNameCacheLookup(NAME, RELATION) \
-       {       RelNameCacheEnt *hentry; bool found; \
-               hentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
-                                                                                          (char *)NAME,HASH_FIND,&found); \
-               if (hentry == NULL) { \
-                       elog(FATAL, "error in CACHE"); \
-                 } \
-               if (found) { \
-                       RELATION = hentry->reldesc; \
-                 } \
-               else { \
-                       RELATION = NULL; \
-                 } \
-       }
-#define RelationIdCacheLookup(ID, RELATION)            \
-       {       RelIdCacheEnt *hentry; bool found; \
-               hentry = (RelIdCacheEnt*)hash_search(RelationIdCache, \
-                                                                                        (char *)&(ID),HASH_FIND, &found); \
-               if (hentry == NULL) { \
-                       elog(FATAL, "error in CACHE"); \
-                 } \
-               if (found) { \
-                       RELATION = hentry->reldesc; \
-                 } \
-               else { \
-                       RELATION = NULL; \
-                 } \
-       }
-#define RelationCacheDelete(RELATION)  \
-       {       RelNameCacheEnt *namehentry; RelIdCacheEnt *idhentry; \
-               char *relname; Oid reloid; bool found; \
-               relname = (RELATION->rd_rel->relname).data; \
-               namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
-                                                                                                  relname, \
-                                                                                                  HASH_REMOVE, \
-                                                                                                  &found); \
-               if (namehentry == NULL) { \
-                       elog(FATAL, "can't delete from relation descriptor cache"); \
-                 } \
-               if (!found) { \
-                       elog(NOTICE, "trying to delete a reldesc that does not exist."); \
-                 } \
-               reloid = RELATION->rd_id; \
-               idhentry = (RelIdCacheEnt*)hash_search(RelationIdCache, \
-                                                                                          (char *)&reloid, \
-                                                                                          HASH_REMOVE, &found); \
-               if (idhentry == NULL) { \
-                       elog(FATAL, "can't delete from relation descriptor cache"); \
-                 } \
-               if (!found) { \
-                       elog(NOTICE, "trying to delete a reldesc that does not exist."); \
-                 } \
-       }
+do { \
+       RelNameCacheEnt *hentry; bool found; \
+       hentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
+                                                                                  (char *)NAME,HASH_FIND,&found); \
+       if (hentry == NULL) \
+               elog(FATAL, "error in CACHE"); \
+       if (found) \
+               RELATION = hentry->reldesc; \
+       else \
+               RELATION = NULL; \
+} while(0)
+
+#define RelationIdCacheLookup(ID, RELATION)    \
+do { \
+       RelIdCacheEnt *hentry; \
+       bool found; \
+       hentry = (RelIdCacheEnt*)hash_search(RelationIdCache, \
+                                                                                (char *)&(ID),HASH_FIND, &found); \
+       if (hentry == NULL) \
+               elog(FATAL, "error in CACHE"); \
+       if (found) \
+               RELATION = hentry->reldesc; \
+       else \
+               RELATION = NULL; \
+} while(0)
+
+#define RelationCacheDelete(RELATION) \
+do { \
+       RelNameCacheEnt *namehentry; RelIdCacheEnt *idhentry; \
+       char *relname; Oid reloid; bool found; \
+       relname = (RELATION->rd_rel->relname).data; \
+       namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
+                                                                                          relname, \
+                                                                                          HASH_REMOVE, \
+                                                                                          &found); \
+       if (namehentry == NULL) \
+               elog(FATAL, "can't delete from relation descriptor cache"); \
+       if (!found) \
+               elog(NOTICE, "trying to delete a reldesc that does not exist."); \
+       reloid = RELATION->rd_id; \
+       idhentry = (RelIdCacheEnt*)hash_search(RelationIdCache, \
+                                                                                  (char *)&reloid, \
+                                                                                  HASH_REMOVE, &found); \
+       if (idhentry == NULL) \
+               elog(FATAL, "can't delete from relation descriptor cache"); \
+       if (!found) \
+               elog(NOTICE, "trying to delete a reldesc that does not exist."); \
+} while(0)
 
 /* non-export function prototypes */
 static void
index f56bc4cf0aecda711ee49a0162102d1670c3e3c5..e12b6f44ac9a3ea8da45e2711a6b066e65935f80 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.10 1998/02/26 04:38:23 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.11 1998/06/15 18:39:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -125,41 +125,49 @@ typedef struct portalhashent
 static HTAB *PortalHashTable = NULL;
 
 #define PortalHashTableLookup(NAME, PORTAL) \
-       {       PortalHashEnt *hentry; bool found; char key[MAX_PORTALNAME_LEN]; \
-               MemSet(key, 0, MAX_PORTALNAME_LEN); \
-               sprintf(key, "%s", NAME); \
-               hentry = (PortalHashEnt*)hash_search(PortalHashTable, \
-                                                                                        key, HASH_FIND, &found); \
-               if (hentry == NULL) \
-                       elog(FATAL, "error in PortalHashTable"); \
-               if (found) \
-                       PORTAL = hentry->portal; \
-               else \
-                       PORTAL = NULL; \
-       }
+do { \
+       PortalHashEnt *hentry; bool found; char key[MAX_PORTALNAME_LEN]; \
+       \
+       MemSet(key, 0, MAX_PORTALNAME_LEN); \
+       sprintf(key, "%s", NAME); \
+       hentry = (PortalHashEnt*)hash_search(PortalHashTable, \
+                                                                                key, HASH_FIND, &found); \
+       if (hentry == NULL) \
+               elog(FATAL, "error in PortalHashTable"); \
+       if (found) \
+               PORTAL = hentry->portal; \
+       else \
+               PORTAL = NULL; \
+} while(0)
+
 #define PortalHashTableInsert(PORTAL) \
-       {       PortalHashEnt *hentry; bool found; char key[MAX_PORTALNAME_LEN]; \
-               MemSet(key, 0, MAX_PORTALNAME_LEN); \
-               sprintf(key, "%s", PORTAL->name); \
-               hentry = (PortalHashEnt*)hash_search(PortalHashTable, \
-                                                                                        key, HASH_ENTER, &found); \
-               if (hentry == NULL) \
-                       elog(FATAL, "error in PortalHashTable"); \
-               if (found) \
-                       elog(NOTICE, "trying to insert a portal name that exists."); \
-               hentry->portal = PORTAL; \
-       }
+do { \
+       PortalHashEnt *hentry; bool found; char key[MAX_PORTALNAME_LEN]; \
+       \
+       MemSet(key, 0, MAX_PORTALNAME_LEN); \
+       sprintf(key, "%s", PORTAL->name); \
+       hentry = (PortalHashEnt*)hash_search(PortalHashTable, \
+                                                                                key, HASH_ENTER, &found); \
+       if (hentry == NULL) \
+               elog(FATAL, "error in PortalHashTable"); \
+       if (found) \
+               elog(NOTICE, "trying to insert a portal name that exists."); \
+       hentry->portal = PORTAL; \
+} while(0)
+
 #define PortalHashTableDelete(PORTAL) \
-       {       PortalHashEnt *hentry; bool found; char key[MAX_PORTALNAME_LEN]; \
-               MemSet(key, 0, MAX_PORTALNAME_LEN); \
-               sprintf(key, "%s", PORTAL->name); \
-               hentry = (PortalHashEnt*)hash_search(PortalHashTable, \
-                                                                                        key, HASH_REMOVE, &found); \
-               if (hentry == NULL) \
-                       elog(FATAL, "error in PortalHashTable"); \
-               if (!found) \
-                       elog(NOTICE, "trying to delete portal name that does not exist."); \
-       }
+{ \
+       PortalHashEnt *hentry; bool found; char key[MAX_PORTALNAME_LEN]; \
+       \
+       MemSet(key, 0, MAX_PORTALNAME_LEN); \
+       sprintf(key, "%s", PORTAL->name); \
+       hentry = (PortalHashEnt*)hash_search(PortalHashTable, \
+                                                                                key, HASH_REMOVE, &found); \
+       if (hentry == NULL) \
+               elog(FATAL, "error in PortalHashTable"); \
+       if (!found) \
+               elog(NOTICE, "trying to delete portal name that does not exist."); \
+} while(0)
 
 static GlobalMemory PortalMemory = NULL;
 static char PortalMemoryName[] = "Portal";
index fa439f520ed07a9c26496c7aeeb89b79dd54a3ac..926c464fd26a53a34cad218620f4ad9846160123 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.39 1998/02/26 04:38:29 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.40 1998/06/15 18:39:45 momjian Exp $
  *
  * NOTES
  *             Sorts the first relation into the second relation.
@@ -222,20 +222,24 @@ inittapes(Sort *node)
  */
 
 
-#define PUTTUP(NODE, TUP, FP) do {\
-       ((Psortstate *)NODE->psortstate)->BytesWritten += (TUP)->t_len; \
-       fwrite((char *)TUP, (TUP)->t_len, 1, FP); \
-       fwrite((char *)&((TUP)->t_len), sizeof (tlendummy), 1, FP); \
-       } while (0)
+#define PUTTUP(NODE, TUP, FP) \
+( \
+       ((Psortstate *)NODE->psortstate)->BytesWritten += (TUP)->t_len, \
+       fwrite((char *)TUP, (TUP)->t_len, 1, FP), \
+       fwrite((char *)&((TUP)->t_len), sizeof (tlendummy), 1, FP) \
+)
+
 #define ENDRUN(FP)             fwrite((char *)&tlenzero, sizeof (tlenzero), 1, FP)
 #define GETLEN(LEN, FP) fread((char *)&(LEN), sizeof (tlenzero), 1, FP)
 #define ALLOCTUP(LEN)  ((HeapTuple)palloc((unsigned)LEN))
-#define GETTUP(NODE, TUP, LEN, FP) do {\
-       IncrProcessed(); \
-       ((Psortstate *)NODE->psortstate)->BytesRead += (LEN) - sizeof (tlenzero); \
-       fread((char *)(TUP) + sizeof (tlenzero), (LEN) - sizeof (tlenzero), 1, FP); \
-       fread((char *)&tlendummy, sizeof (tlendummy), 1, FP); \
-       } while (0)
+#define GETTUP(NODE, TUP, LEN, FP) \
+( \
+       IncrProcessed(), \
+       ((Psortstate *)NODE->psortstate)->BytesRead += (LEN) - sizeof (tlenzero), \
+       fread((char *)(TUP) + sizeof (tlenzero), (LEN) - sizeof (tlenzero), 1, FP), \
+       fread((char *)&tlendummy, sizeof (tlendummy), 1, FP) \
+)
+
 #define SETTUPLEN(TUP, LEN)            (TUP)->t_len = LEN
 
  /*
index 166e60098002d36261d12f3be1c92f037d849222..0ecfa7b6c94fdc163c54dc406c7da58eb78a1775 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: psqlHelp.h,v 1.42 1998/03/30 19:04:53 momjian Exp $
+ * $Id: psqlHelp.h,v 1.43 1998/06/15 18:39:49 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,8 +26,8 @@ static struct _helpStruct QL_HELP[] = {
        "abort [transaction];"},
        {"alter table",
                "add/rename attributes, rename tables",
-       "\talter table <class_name> [*] add column <attr> <type>;\n\
-\talter table <class_name> [*] rename [column] <attr1> to <attr2>;\n\
+       "\talter table <class_name> [*] add column <attr> <type>\n\
+\talter table <class_name> [*] rename [column] <attr1> to <attr2>\n\
 \talter table <class_name1> rename to <class_name2>"},
        {"alter user",
                "alter system information for a user",
@@ -128,7 +128,7 @@ static struct _helpStruct QL_HELP[] = {
                "create a new trigger",
        "create trigger <trigger_name> after|before event1 [or event2 [or event3] ]\n\
 \ton <class_name> for each row|statement\n\
-\texecute procedure <func_name> ([arguments]);\n\
+\texecute procedure <func_name> ([arguments])\n\
 \n\
 \teventX is one of INSERT, DELETE, UPDATE"},
        {"create type",
@@ -238,7 +238,7 @@ static struct _helpStruct QL_HELP[] = {
        {"insert",
                "insert tuples",
        "insert into <class_name> [(<attr1>...<attrN>)]\n\
-\tvalues (<expr1>...<exprN>); |\n\
+\tvalues (<expr1>...<exprN>) |\n\
 \tselect [distinct]\n\
 \t<expr1>,...<exprN>\n\
 \t[from <from_clause>]\n\
index 910e07fc1115b9e76863494a0b9997c8c644d4f3..eb1194f5f32c46a74fd30b162ceadafc452c372f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: attnum.h,v 1.6 1997/09/08 02:34:02 momjian Exp $
+ * $Id: attnum.h,v 1.7 1998/06/15 18:39:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -47,8 +47,10 @@ typedef int16 AttrNumber;
  *             Assumes the attribute number is for an user defined attribute.
  */
 #define AttrNumberGetAttrOffset(attNum) \
-        (AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)) ? \
-         ((attNum - 1)) : 0)
+( \
+       AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)), \
+       ((attNum) - 1) \
+)
 
 /*
  * AttributeOffsetGetAttributeNumber --
index 56aa0e66eb045d298f5e217fc0533957f80febc8..f0fff75d4ca6c3b908f40aa8ab56eec326ca4cde 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: heapam.h,v 1.32 1998/06/14 01:34:07 momjian Exp $
+ * $Id: heapam.h,v 1.33 1998/06/15 18:39:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -92,43 +92,37 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
 
 #define fastgetattr(tup, attnum, tupleDesc, isnull) \
 ( \
-       AssertMacro((attnum) > 0) ? \
+       AssertMacro((attnum) > 0), \
+       ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \
+       HeapTupleNoNulls(tup) ? \
        ( \
-               ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \
-               HeapTupleNoNulls(tup) ? \
+               ((tupleDesc)->attrs[(attnum)-1]->attcacheoff != -1 || \
+                (attnum) == 1) ? \
                ( \
-                       ((tupleDesc)->attrs[(attnum)-1]->attcacheoff != -1 || \
-                        (attnum) == 1) ? \
-                       ( \
-                               (Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \
-                                       (char *) (tup) + (tup)->t_hoff + \
-                                       ( \
-                                               ((attnum) != 1) ? \
-                                                       (tupleDesc)->attrs[(attnum)-1]->attcacheoff \
-                                               : \
-                                                       0 \
-                                       ) \
+                       (Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \
+                               (char *) (tup) + (tup)->t_hoff + \
+                               ( \
+                                       ((attnum) != 1) ? \
+                                               (tupleDesc)->attrs[(attnum)-1]->attcacheoff \
+                                       : \
+                                               0 \
                                ) \
                        ) \
-                       : \
-                               nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
                ) \
                : \
-               ( \
-                       att_isnull((attnum)-1, (tup)->t_bits) ? \
-                       ( \
-                               ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
-                               (Datum)NULL \
-                       ) \
-                       : \
-                       ( \
-                               nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
-                       ) \
-               ) \
+                       nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
        ) \
        : \
        ( \
-                (Datum)NULL \
+               att_isnull((attnum)-1, (tup)->t_bits) ? \
+               ( \
+                       ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
+                       (Datum)NULL \
+               ) \
+               : \
+               ( \
+                       nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
+               ) \
        ) \
 )
 
@@ -208,39 +202,33 @@ static Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
 ( \
        AssertMacro((tup) != NULL && \
                (attnum) > FirstLowInvalidHeapAttributeNumber && \
-               (attnum) != 0) ? \
+               (attnum) != 0), \
+       ((attnum) > (int) (tup)->t_natts) ? \
        ( \
-               ((attnum) > (int) (tup)->t_natts) ? \
+               ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
+               (Datum)NULL \
+       ) \
+       : \
+       ( \
+               ((attnum) > 0) ? \
                ( \
-                       ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
-                       (Datum)NULL \
+                       fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
                ) \
                : \
                ( \
-                       ((attnum) > 0) ? \
+                       ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \
+                       ((attnum) == SelfItemPointerAttributeNumber) ? \
                        ( \
-                               fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
+                               (Datum)((char *)(tup) + \
+                                       heap_sysoffset[-SelfItemPointerAttributeNumber-1]) \
                        ) \
                        : \
                        ( \
-                               ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \
-                               ((attnum) == SelfItemPointerAttributeNumber) ? \
-                               ( \
-                                       (Datum)((char *)(tup) + \
-                                               heap_sysoffset[-SelfItemPointerAttributeNumber-1]) \
-                               ) \
-                               : \
-                               ( \
-                                       (Datum)*(unsigned int *) \
-                                               ((char *)(tup) + heap_sysoffset[-(attnum)-1]) \
-                               ) \
+                               (Datum)*(unsigned int *) \
+                                       ((char *)(tup) + heap_sysoffset[-(attnum)-1]) \
                        ) \
                ) \
        ) \
-       : \
-       ( \
-                (Datum)NULL \
-       ) \
 )
 
 extern HeapAccessStatistics heap_access_stats; /* in stats.c */
index 68fa5e2a7b01aa94577b393f2de23f0a5b6de4d3..40d26f3feb17ace4756c60015672b7d0ae33c35b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: itup.h,v 1.13 1998/02/26 04:40:19 momjian Exp $
+ * $Id: itup.h,v 1.14 1998/06/15 18:39:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -118,49 +118,43 @@ typedef struct PredInfo
  */
 #define index_getattr(tup, attnum, tupleDesc, isnull) \
 ( \
-       AssertMacro(PointerIsValid(isnull) && (attnum) > 0) ? \
+       AssertMacro(PointerIsValid(isnull) && (attnum) > 0), \
+       *(isnull) = false, \
+       IndexTupleNoNulls(tup) ? \
        ( \
-               *(isnull) = false, \
-               IndexTupleNoNulls(tup) ? \
+               ((tupleDesc)->attrs[(attnum)-1]->attcacheoff != -1 || \
+                (attnum) == 1) ? \
                ( \
-                       ((tupleDesc)->attrs[(attnum)-1]->attcacheoff != -1 || \
-                        (attnum) == 1) ? \
+                       (Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \
+                       (char *) (tup) + \
                        ( \
-                               (Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \
-                                       (char *) (tup) + \
-                                       ( \
-                                               IndexTupleHasMinHeader(tup) ? \
-                                                       sizeof (*(tup)) \
-                                               : \
-                                                       IndexInfoFindDataOffset((tup)->t_info) \
-                                       ) + \
-                                       ( \
-                                               ((attnum) != 1) ? \
-                                                       (tupleDesc)->attrs[(attnum)-1]->attcacheoff \
-                                               : \
-                                                       0 \
-                                       ) \
+                               IndexTupleHasMinHeader(tup) ? \
+                                               sizeof (*(tup)) \
+                                       : \
+                                               IndexInfoFindDataOffset((tup)->t_info) \
+                               ) + \
+                               ( \
+                                       ((attnum) != 1) ? \
+                                               (tupleDesc)->attrs[(attnum)-1]->attcacheoff \
+                                       : \
+                                               0 \
                                ) \
                        ) \
-                       : \
-                               nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \
                ) \
                : \
-               ( \
-                       (att_isnull((attnum)-1, (char *)(tup) + sizeof(*(tup)))) ? \
-                       ( \
-                               *(isnull) = true, \
-                               (Datum)NULL \
-                       ) \
-                       : \
-                       ( \
-                               nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \
-                       ) \
-               ) \
+                       nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \
        ) \
        : \
        ( \
-                (Datum)NULL \
+               (att_isnull((attnum)-1, (char *)(tup) + sizeof(*(tup)))) ? \
+               ( \
+                       *(isnull) = true, \
+                       (Datum)NULL \
+               ) \
+               : \
+               ( \
+                       nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \
+               ) \
        ) \
 )
 
index bbc8426e99c2fcdc8fa8d594856c0cc1395b5298..f9b13fffc9b7960eec2c29ffa5750b30664025c5 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: c.h,v 1.39 1998/04/06 17:27:49 momjian Exp $
+ * $Id: c.h,v 1.40 1998/06/15 18:39:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -624,7 +624,7 @@ typedef struct Exception
                Trap(!(condition), FailedAssertion)
 
 #define AssertMacro(condition) \
-               TrapMacro(!(condition), FailedAssertion)
+               (void)TrapMacro(!(condition), FailedAssertion)
 
 #define AssertArg(condition) \
                Trap(!(condition), BadArg)
index 4337b3d1b4c7228d85484a113b34199a8605d5b2..d9a746a7255a835bb0d8efc2bc31304c4d114a58 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: execdebug.h,v 1.4 1997/09/08 02:36:12 momjian Exp $
+ * $Id: execdebug.h,v 1.5 1998/06/15 18:39:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -193,14 +193,15 @@ extern int        NIndexTupleInserted;
 #define IncrIndexProcessed()   NIndexTupleProcessed++
 #define IncrIndexInserted()            NIndexTupleInserted++
 #else
-#define IncrRetrieved()
-#define IncrAppended()
-#define IncrDeleted()
-#define IncrReplaced()
-#define IncrInserted()
-#define IncrProcessed()
-#define IncrIndexProcessed()
-#define IncrIndexInserted()
+/*                                                             stop compiler warnings */
+#define IncrRetrieved()                        (void)(0)
+#define IncrAppended()                 (void)(0)
+#define IncrDeleted()                  (void)(0)
+#define IncrReplaced()                 (void)(0)
+#define IncrInserted()                 (void)(0)
+#define IncrProcessed()                        (void)(0)
+#define IncrIndexProcessed()   (void)(0)
+#define IncrIndexInserted()            (void)(0)
 #endif                                                 /* EXEC_TUPLECOUNT */
 
 /* ----------------
index 02b181174f0a44cf7f3130fd63be74cf6f9bec0a..17b937868827ba2351dd627ea1e75f159f7ffd6b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: block.h,v 1.5 1997/09/08 20:58:59 momjian Exp $
+ * $Id: block.h,v 1.6 1998/06/15 18:40:00 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -79,19 +79,23 @@ typedef BlockIdData *BlockId;       /* block identifier */
  *             Sets a block identifier to the specified value.
  */
 #define BlockIdSet(blockId, blockNumber) \
-       Assert(PointerIsValid(blockId)); \
-       (blockId)->bi_hi = (blockNumber) >> 16; \
-       (blockId)->bi_lo = (blockNumber) & 0xffff
+( \
+       AssertMacro(PointerIsValid(blockId)), \
+       (blockId)->bi_hi = (blockNumber) >> 16, \
+       (blockId)->bi_lo = (blockNumber) & 0xffff \
+)
 
 /*
  * BlockIdCopy --
  *             Copy a block identifier.
  */
 #define BlockIdCopy(toBlockId, fromBlockId) \
-       Assert(PointerIsValid(toBlockId)); \
-       Assert(PointerIsValid(fromBlockId)); \
-       (toBlockId)->bi_hi = (fromBlockId)->bi_hi; \
-       (toBlockId)->bi_lo = (fromBlockId)->bi_lo
+( \
+       AssertMacro(PointerIsValid(toBlockId)), \
+       AssertMacro(PointerIsValid(fromBlockId)), \
+       (toBlockId)->bi_hi = (fromBlockId)->bi_hi, \
+       (toBlockId)->bi_lo = (fromBlockId)->bi_lo \
+)
 
 /*
  * BlockIdEquals --
@@ -106,8 +110,9 @@ typedef BlockIdData *BlockId;       /* block identifier */
  *             Retrieve the block number from a block identifier.
  */
 #define BlockIdGetBlockNumber(blockId) \
-       (AssertMacro(BlockIdIsValid(blockId)) ? \
-        (BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) : \
-        (BlockNumber) InvalidBlockNumber)
+( \
+       AssertMacro(BlockIdIsValid(blockId)), \
+       (BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) \
+)
 
 #endif                                                 /* BLOCK_H */
index e3ccfb9288673bbcbcf614a4f2cf28b57984a431..ac9f76182cc15a3755a659380c8c3347967ad328 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: buf_internals.h,v 1.21 1998/02/26 04:43:21 momjian Exp $
+ * $Id: buf_internals.h,v 1.22 1998/06/15 18:40:01 momjian Exp $
  *
  * NOTE
  *             If BUFFERPAGE0 is defined, then 0 will be used as a
@@ -55,26 +55,32 @@ struct buftag
        BlockNumber blockNum;           /* blknum relative to begin of reln */
 };
 
-#define CLEAR_BUFFERTAG(a)\
-  (a)->relId.dbId = InvalidOid; \
-  (a)->relId.relId = InvalidOid; \
-  (a)->blockNum = InvalidBlockNumber
+#define CLEAR_BUFFERTAG(a) \
+( \
+       (a)->relId.dbId = InvalidOid, \
+       (a)->relId.relId = InvalidOid, \
+       (a)->blockNum = InvalidBlockNumber \
+)
 
 #define INIT_BUFFERTAG(a,xx_reln,xx_blockNum) \
-{ \
-  (a)->blockNum = xx_blockNum;\
-  (a)->relId = RelationGetLRelId(xx_reln); \
-}
+( \
+       (a)->blockNum = xx_blockNum, \
+       (a)->relId = RelationGetLRelId(xx_reln) \
+)
+
 #ifdef NOT_USED
-#define COPY_BUFFERTAG(a,b)\
-{ \
-  (a)->blockNum = (b)->blockNum;\
-  LRelIdAssign(*(a),*(b));\
-}
+#define COPY_BUFFERTAG(a,b) \
+( \
+       (a)->blockNum = (b)->blockNum, \
+       LRelIdAssign(*(a),*(b)) \
+)
 
 #define EQUAL_BUFFERTAG(a,b) \
-  (((a)->blockNum == (b)->blockNum) &&\
-   (OID_Equal((a)->relId.relId,(b)->relId.relId)))
+( \
+       ((a)->blockNum == (b)->blockNum && \
+        OID_Equal((a)->relId.relId,(b)->relId.relId)) \
+)
+
 #endif
 
 #define BAD_BUFFER_ID(bid) ((bid<1) || (bid>(NBuffers)))
index f27e9d1ed3a98ffbf9e86e3cce9add768bdb1e72..9b590227b5a91e27dc3c5bd81374b8fe151bd68b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: bufmgr.h,v 1.19 1998/04/24 14:43:18 momjian Exp $
+ * $Id: bufmgr.h,v 1.20 1998/06/15 18:40:02 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -117,8 +117,7 @@ extern int  ShowPinTrace;
  */
 #define BufferGetBlock(buffer) \
 ( \
-       (void)AssertMacro(BufferIsValid(buffer)), \
-\
+       AssertMacro(BufferIsValid(buffer)), \
        BufferIsLocal(buffer) ? \
                ((Block) MAKE_PTR(LocalBufferDescriptors[-(buffer) - 1].data)) \
        : \
index c0701fc963dc77a7a48c04f6bde46a1b7efb7a14..123192f914f6bc5a2e8dd3cbd3ec88044bac042e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: bufpage.h,v 1.18 1998/04/24 14:43:23 momjian Exp $
+ * $Id: bufpage.h,v 1.19 1998/06/15 18:40:02 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -161,8 +161,10 @@ typedef enum
  *             Assumes page is valid.
  */
 #define PageIsUsed(page) \
-       (AssertMacro(PageIsValid(page)) ? \
-        ((bool) (((PageHeader) (page))->pd_lower != 0)) : false)
+( \
+       AssertMacro(PageIsValid(page)), \
+       ((bool) (((PageHeader) (page))->pd_lower != 0)) \
+)
 
 /*
  * PageIsEmpty --
@@ -243,9 +245,10 @@ typedef enum
  *             Assumes page is locked.
  */
 #define PageGetSpecialPointer(page) \
-       (AssertMacro(PageIsValid(page)) ? \
-        (char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
-        : (char *)0 )
+( \
+       AssertMacro(PageIsValid(page)), \
+       (char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
+)
 
 /*
  * PageGetItem --
@@ -256,9 +259,11 @@ typedef enum
  *             The semantics may change in the future.
  */
 #define PageGetItem(page, itemId) \
-       (AssertMacro(PageIsValid(page)) ? \
-        AssertMacro((itemId)->lp_flags & LP_USED) ? \
-       (Item)(((char *)(page)) + (itemId)->lp_off) : false : false)
+( \
+       AssertMacro(PageIsValid(page)), \
+       AssertMacro((itemId)->lp_flags & LP_USED), \
+       (Item)(((char *)(page)) + (itemId)->lp_off) \
+)
 
 /*
  * BufferGetPageSize --
@@ -272,7 +277,10 @@ typedef enum
  */
 /* XXX dig out of buffer descriptor */
 #define BufferGetPageSize(buffer) \
-       (AssertMacro(BufferIsValid(buffer)) ? (Size)BLCKSZ : false)
+( \
+       AssertMacro(BufferIsValid(buffer)), \
+       (Size)BLCKSZ \
+)
 
 /*
  * BufferGetPage --
index 7b683ab68c56837aec1ef31f7dc5cb2cfb8079fe..5a3953c32e525814d5370dee69b67109709bde79 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: itemid.h,v 1.5 1998/01/13 04:05:12 scrappy Exp $
+ * $Id: itemid.h,v 1.6 1998/06/15 18:40:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -70,7 +70,9 @@ typedef struct ItemIdData *ItemId;
  *             Assumes disk item identifier is valid.
  */
 #define ItemIdIsUsed(itemId) \
-       (AssertMacro(ItemIdIsValid(itemId)) ? \
-        (bool) (((itemId)->lp_flags & LP_USED) != 0) : false)
+( \
+       AssertMacro(ItemIdIsValid(itemId)), \
+       (bool) (((itemId)->lp_flags & LP_USED) != 0) \
+)
 
 #endif                                                 /* ITEMID_H */
index 5bac77c9fccceea56fbf8533cd2a0771b4a148ee..c6922a093f5d2564cd50ae4f7b1209116fbdcf23 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: itemptr.h,v 1.7 1997/09/08 21:54:25 momjian Exp $
+ * $Id: itemptr.h,v 1.8 1998/06/15 18:40:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -48,60 +48,73 @@ typedef ItemPointerData *ItemPointer;
  *             Returns the block number of a disk item pointer.
  */
 #define ItemPointerGetBlockNumber(pointer) \
-       (AssertMacro(ItemPointerIsValid(pointer)) ? \
-        BlockIdGetBlockNumber(&(pointer)->ip_blkid) : (BlockNumber) 0)
+( \
+       AssertMacro(ItemPointerIsValid(pointer)), \
+       BlockIdGetBlockNumber(&(pointer)->ip_blkid) \
+)
 
 /*
  * ItemPointerGetOffsetNumber --
  *             Returns the offset number of a disk item pointer.
  */
 #define ItemPointerGetOffsetNumber(pointer) \
-       (AssertMacro(ItemPointerIsValid(pointer)) ? \
-        (pointer)->ip_posid : \
-        InvalidOffsetNumber)
+( \
+       AssertMacro(ItemPointerIsValid(pointer)), \
+       (pointer)->ip_posid \
+)
 
 /*
  * ItemPointerSet --
  *             Sets a disk item pointer to the specified block and offset.
  */
 #define ItemPointerSet(pointer, blockNumber, offNum) \
-       Assert(PointerIsValid(pointer)); \
-       BlockIdSet(&((pointer)->ip_blkid), blockNumber); \
-       (pointer)->ip_posid = offNum
+( \
+       AssertMacro(PointerIsValid(pointer)), \
+       BlockIdSet(&((pointer)->ip_blkid), blockNumber), \
+       (pointer)->ip_posid = offNum \
+)
 
 /*
  * ItemPointerSetBlockNumber --
  *             Sets a disk item pointer to the specified block.
  */
 #define ItemPointerSetBlockNumber(pointer, blockNumber) \
-       Assert(PointerIsValid(pointer)); \
-       BlockIdSet(&((pointer)->ip_blkid), blockNumber)
+( \
+       AssertMacro(PointerIsValid(pointer)), \
+       BlockIdSet(&((pointer)->ip_blkid), blockNumber) \
+)
 
 /*
  * ItemPointerSetOffsetNumber --
  *             Sets a disk item pointer to the specified offset.
  */
 #define ItemPointerSetOffsetNumber(pointer, offsetNumber) \
-       AssertMacro(PointerIsValid(pointer)); \
-       (pointer)->ip_posid = (offsetNumber)
+( \
+       AssertMacro(PointerIsValid(pointer)), \
+       (pointer)->ip_posid = (offsetNumber) \
+)
 
 /*
  * ItemPointerCopy --
  *             Copies the contents of one disk item pointer to another.
  */
 #define ItemPointerCopy(fromPointer, toPointer) \
-       Assert(PointerIsValid(toPointer)); \
-       Assert(PointerIsValid(fromPointer)); \
-       *(toPointer) = *(fromPointer)
+( \
+       AssertMacro(PointerIsValid(toPointer)), \
+       AssertMacro(PointerIsValid(fromPointer)), \
+       *(toPointer) = *(fromPointer) \
+)
 
 /*
  * ItemPointerSetInvalid --
  *             Sets a disk item pointer to be invalid.
  */
 #define ItemPointerSetInvalid(pointer) \
-       Assert(PointerIsValid(pointer)); \
-       BlockIdSet(&((pointer)->ip_blkid), InvalidBlockNumber); \
-       (pointer)->ip_posid = InvalidOffsetNumber
+( \
+       AssertMacro(PointerIsValid(pointer)), \
+       BlockIdSet(&((pointer)->ip_blkid), InvalidBlockNumber), \
+       (pointer)->ip_posid = InvalidOffsetNumber \
+)
 
 /* ----------------
  *             externs
index 0cbca115e9cdafc473071464f7e92773fc205ff9..05c6a0f468842c3e803a03b42c24549977b146e8 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lock.h,v 1.11 1998/02/26 04:43:28 momjian Exp $
+ * $Id: lock.h,v 1.12 1998/06/15 18:40:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -191,8 +191,10 @@ typedef struct Lock
 #define LockGetLock_nHolders(l) l->nHolders
 
 #define LockDecrWaitHolders(lock, lockt) \
-  lock->nHolding--; \
-  lock->holders[lockt]--
+( \
+  lock->nHolding--, \
+  lock->holders[lockt]-- \
+)
 
 #define LockLockTable() SpinAcquire(LockMgrLock);
 #define UnlockLockTable() SpinRelease(LockMgrLock);
index 2731d1d494ab7c242ae331abce2f641cc706417b..369a3d8724fc5c32d1a0c9f5c72f0dc07d210e59 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.34 1998/05/06 23:25:14 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.35 1998/06/15 18:40:04 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -209,19 +209,22 @@ extern void s_lock(slock_t *lock);
 
 #else /* S_LOCK_DEBUG */
 
-#define S_LOCK(lock) if (1) { \
+#define S_LOCK(lock) \
+do { \
        int spins = 0; \
-       while (TAS(lock)) { \
+       while (TAS(lock)) \
+       { \
                struct timeval  delay; \
                delay.tv_sec = 0; \
                delay.tv_usec = s_spincycle[spins++ % S_NSPINCYCLE]; \
                (void) select(0, NULL, NULL, NULL, &delay); \
-               if (spins > S_MAX_BUSY) { \
+               if (spins > S_MAX_BUSY) \
+               { \
                        /* It's been well over a minute...  */ \
                        s_lock_stuck(lock, __FILE__, __LINE__); \
                } \
        } \
-} else
+} while(0)
 
 #endif /* S_LOCK_DEBUG */
 #endif /* S_LOCK */
index 7400f9ce0386353ca6ceeb95d8ad360f45d96bdd..809361c639cf4581cd7aa1800df559011cbcf45e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: exc.h,v 1.12 1998/02/26 04:43:59 momjian Exp $
+ * $Id: exc.h,v 1.13 1998/06/15 18:40:05 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -47,23 +47,28 @@ typedef struct ExcFrame
 
 extern ExcFrame *ExcCurFrameP;
 
-#define ExcBegin()                                                                                                             \
-               {                                                                                                                               \
-                               ExcFrame                exception;                                                              \
-                                                                                                                                               \
-                               exception.link = ExcCurFrameP;                                                  \
-                               if (sigsetjmp(exception.context, 1) == 0) {                             \
-                                               ExcCurFrameP = &exception;                                              \
-                                               {
-#define ExcExcept()                                                                                                            \
-                                               }                                                                                               \
-                                               ExcCurFrameP = exception.link;                                  \
-                               } else {                                                                                                \
-                                               {
-#define ExcEnd()                                                                                                               \
-                                               }                                                                                               \
-                               }                                                                                                               \
-               }
+/* These are not used anywhere 1998/6/15 */
+#define ExcBegin() \
+do { \
+       ExcFrame                exception; \
+       \
+       exception.link = ExcCurFrameP; \
+       if (sigsetjmp(exception.context, 1) == 0) \
+       { \
+               ExcCurFrameP = &exception;
+
+#define ExcExcept() \
+       } \
+               ExcCurFrameP = exception.link; \
+       } \
+       else \
+       { \
+               {
+
+#define ExcEnd() \
+                       } \
+               } \
+} while(0)
 
 #define raise4(x, t, d, message) \
                ExcRaise(&(x), (ExcDetail)(t), (ExcData)(d), (ExcMessage)(message))