summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBruce Momjian1997-08-26 23:31:58 +0000
committerBruce Momjian1997-08-26 23:31:58 +0000
commit75c6c2b6082604dcc8732dd99eeb286ea37173bd (patch)
tree58527f581e490113415de5acec5f485c600631e7 /src/include
parent20afa04d03b1d1f58a926d3d183ff792a12073da (diff)
Inlined heap_getattr().
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/heapam.h29
-rw-r--r--src/include/access/heaptuple.h26
-rw-r--r--src/include/storage/bufpage.h8
3 files changed, 30 insertions, 33 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index f16a3bec536..9fdb9af8e75 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.7 1997/08/19 21:37:30 momjian Exp $
+ * $Id: heapam.h,v 1.8 1997/08/26 23:31:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -78,6 +78,30 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
#define IncrHeapAccessStat(x) \
(heap_access_stats == NULL ? 0 : (heap_access_stats->x)++)
+/* ----------------
+ * heap_getattr
+ *
+ * Find a particular field in a row represented as a heap tuple.
+ * We return a pointer into that heap tuple, which points to the
+ * first byte of the value of the field in question.
+ *
+ * If the field in question has a NULL value, we return a null
+ * pointer and return <*isnull> == true. Otherwise, we return
+ * <*isnull> == false.
+ *
+ * <tup> is the pointer to the heap tuple. <attnum> is the attribute
+ * number of the column (field) caller wants. <tupleDesc> is a
+ * pointer to the structure describing the row and all its fields.
+ * ---------------- */
+#define heap_getattr(tup, b, attnum, tupleDesc, isnull) \
+ (AssertMacro((tup) != NULL) ? \
+ ((attnum) > (int) (tup)->t_natts) ? \
+ (((isnull) ? (*(isnull) = true) : NULL), (char *) NULL) : \
+ ((attnum) > 0) ? \
+ fastgetattr((tup), (attnum), (tupleDesc), (isnull)) : \
+ (((isnull) ? (*(isnull) = false) : NULL), heap_getsysattr((tup), (b), (attnum))) : \
+ (char *) NULL)
+
extern HeapAccessStatistics heap_access_stats; /* in stats.c */
/* ----------------
@@ -114,10 +138,9 @@ extern void DataFill(char *data, TupleDesc tupleDesc,
extern int heap_attisnull(HeapTuple tup, int attnum);
extern int heap_sysattrlen(AttrNumber attno);
extern bool heap_sysattrbyval(AttrNumber attno);
+extern char *heap_getsysattr(HeapTuple tup, Buffer b, int attnum);
extern char *fastgetattr(HeapTuple tup, int attnum,
TupleDesc att, bool *isnull);
-extern char *heap_getattr(HeapTuple tup, Buffer b, int attnum,
- TupleDesc att, bool *isnull);
extern HeapTuple heap_copytuple(HeapTuple tuple);
extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
Datum value[], char nulls[]);
diff --git a/src/include/access/heaptuple.h b/src/include/access/heaptuple.h
deleted file mode 100644
index f01217b97c1..00000000000
--- a/src/include/access/heaptuple.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * heaptuple.h--
- *
- *
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- * $Id: heaptuple.h,v 1.3 1996/11/05 07:18:05 scrappy Exp $
- *
- *-------------------------------------------------------------------------
- */
-#ifndef HEAPTUPLE_H
-#define HEAPTUPLE_H
-
-#include <access/tupdesc.h>
-#include <storage/buf.h>
-#include <access/htup.h>
-
-extern char *heap_getattr(HeapTuple tup,
- Buffer b,
- int attnum,
- TupleDesc tupleDesc,
- bool *isnull);
-
-#endif /* HEAP_TUPLE_H */
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h
index b0408106ef7..3607e4e25e2 100644
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufpage.h,v 1.9 1997/08/24 23:08:01 momjian Exp $
+ * $Id: bufpage.h,v 1.10 1997/08/26 23:31:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -221,7 +221,7 @@ typedef enum {
* Assumes page is locked.
*/
#define PageGetSpecialSize(page) \
- ((uint16) (PageGetPageSize(page) - ((PageHeader)page)->pd_special))
+ ((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
/*
* PageGetSpecialPointer --
@@ -245,8 +245,8 @@ typedef enum {
*/
#define PageGetItem(page, itemId) \
(AssertMacro(PageIsValid(page)) ? \
- AssertMacro(itemId->lp_flags & LP_USED) ? \
- (Item)(((char *)page) + itemId->lp_off) : false : false)
+ AssertMacro((itemId)->lp_flags & LP_USED) ? \
+ (Item)(((char *)(page)) + (itemId)->lp_off) : false : false)
/*
* BufferGetPageSize --