summaryrefslogtreecommitdiff
path: root/src/include/nodes/pg_list.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/nodes/pg_list.h')
-rw-r--r--src/include/nodes/pg_list.h40
1 files changed, 11 insertions, 29 deletions
diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h
index 08a11ef552..9394f22439 100644
--- a/src/include/nodes/pg_list.h
+++ b/src/include/nodes/pg_list.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.45 2004/05/26 19:30:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.46 2004/05/30 23:40:39 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,15 +17,6 @@
#include "nodes/nodes.h"
/*
- * As a temporary measure, enable the compatibility API unless the
- * include site specifically disabled it. Once the rest of the source
- * tree has been converted to the new API, this will be removed.
- */
-#ifndef DISABLE_LIST_COMPAT
-#define ENABLE_LIST_COMPAT
-#endif
-
-/*
* This package implements singly-linked homogeneous lists. It is
* important to have constant-time length, append, and prepend
* operations. To achieve this, we deal with two distinct data
@@ -50,15 +41,14 @@
*/
typedef struct ListCell ListCell;
-typedef struct List List;
-struct List
+typedef struct List
{
NodeTag type; /* T_List, T_IntList, or T_OidList */
int length;
- ListCell *head;
- ListCell *tail;
-};
+ ListCell *head;
+ ListCell *tail;
+} List;
struct ListCell
{
@@ -132,6 +122,10 @@ extern int list_length(List *l);
#define linitial_int(l) lfirst_int(list_head(l))
#define linitial_oid(l) lfirst_oid(list_head(l))
+#define llast(l) lfirst(list_tail(l))
+#define llast_int(l) lfirst_int(list_tail(l))
+#define llast_oid(l) lfirst_oid(list_tail(l))
+
#define lsecond(l) lfirst(lnext(list_head(l)))
#define lsecond_int(l) lfirst_int(lnext(list_head(l)))
#define lsecond_oid(l) lfirst_oid(lnext(list_head(l)))
@@ -183,7 +177,7 @@ extern int list_length(List *l);
* simultaneously. This macro loops through both lists at the same
* time, stopping when either list runs out of elements. Depending
* on the requirements of the call site, it may also be wise to
- * ensure that the lengths of the two lists are equal.
+ * assert that the lengths of the two lists are equal.
*/
#define forboth(cell1, list1, cell2, list2) \
for ((cell1) = list_head(list1), (cell2) = list_head(list2); \
@@ -249,8 +243,6 @@ extern List *list_copy_tail(List *list, int nskip);
#define lfirsti(lc) lfirst_int(lc)
#define lfirsto(lc) lfirst_oid(lc)
-#define llast(l) lfirst(list_tail(l))
-
#define makeList1(x1) list_make1(x1)
#define makeList2(x1, x2) list_make2(x1, x2)
#define makeList3(x1, x2, x3) list_make3(x1, x2, x3)
@@ -307,21 +299,13 @@ extern List *list_copy_tail(List *list, int nskip);
extern int length(List *list);
-#endif
+#endif /* ENABLE_LIST_COMPAT */
-/*
- * Temporary hack: we define the FastList type whether the
- * compatibility API is enabled or not, since this allows files that
- * don't use the compatibility API to include headers that reference
- * the FastList type without an error.
- */
typedef struct FastList
{
List *list;
} FastList;
-#ifdef ENABLE_LIST_COMPAT
-
extern void FastListInit(FastList *fl);
extern void FastListFromList(FastList *fl, List *list);
extern List *FastListValue(FastList *fl);
@@ -332,6 +316,4 @@ extern void FastAppendo(FastList *fl, Oid datum);
extern void FastConc(FastList *fl, List *cells);
extern void FastConcFast(FastList *fl1, FastList *fl2);
-#endif
-
#endif /* PG_LIST_H */