summaryrefslogtreecommitdiff
path: root/src/backend/utils/mmgr/portalmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/mmgr/portalmem.c')
-rw-r--r--src/backend/utils/mmgr/portalmem.c76
1 files changed, 42 insertions, 34 deletions
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index f56bc4cf0a..e12b6f44ac 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -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";