Skip to content

Commit ba0f38d

Browse files
committed
FastList is history, yay.
1 parent aad4196 commit ba0f38d

File tree

2 files changed

+24
-114
lines changed

2 files changed

+24
-114
lines changed

src/backend/nodes/list.c

Lines changed: 4 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.58 2004/05/30 23:40:27 neilc Exp $
12+
* $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.59 2004/06/01 06:02:12 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
1616
#include "postgres.h"
17+
1718
#include "nodes/pg_list.h"
1819

20+
1921
/*
2022
* Routines to simplify writing assertions about the type of a list; a
2123
* NIL list is considered to be an empty list of any type.
@@ -1069,7 +1071,7 @@ list_length(List *l)
10691071
*
10701072
* In order to avoid warnings for these function definitions, we need
10711073
* to include a prototype here as well as in pg_list.h. That's because
1072-
* we explicitly disable list API compatibility in list.c, so we
1074+
* we don't enable list API compatibility in list.c, so we
10731075
* don't see the prototypes for these functions.
10741076
*/
10751077

@@ -1087,80 +1089,3 @@ length(List *list)
10871089
{
10881090
return list_length(list);
10891091
}
1090-
1091-
/*
1092-
* This code implements the old "Fast List" API, making use of the new
1093-
* List code to do so. There's no need for FastList anymore, so this
1094-
* code is a bit sloppy -- it will be removed soon.
1095-
*/
1096-
void FastListInit(FastList *fl);
1097-
1098-
void
1099-
FastListInit(FastList *fl)
1100-
{
1101-
fl->list = NIL;
1102-
}
1103-
1104-
void FastListFromList(FastList *fl, List *l);
1105-
1106-
void
1107-
FastListFromList(FastList *fl, List *list)
1108-
{
1109-
fl->list = list;
1110-
}
1111-
1112-
List *FastListValue(FastList *fl);
1113-
1114-
List *
1115-
FastListValue(FastList *fl)
1116-
{
1117-
return fl->list;
1118-
}
1119-
1120-
void makeFastList1(FastList *fl, void *elem);
1121-
1122-
void
1123-
makeFastList1(FastList *fl, void *elem)
1124-
{
1125-
fl->list = list_make1(elem);
1126-
}
1127-
1128-
void FastAppend(FastList *fl, void *datum);
1129-
1130-
void
1131-
FastAppend(FastList *fl, void *datum)
1132-
{
1133-
fl->list = lappend(fl->list, datum);
1134-
}
1135-
1136-
void FastAppendi(FastList *fl, int datum);
1137-
1138-
void
1139-
FastAppendi(FastList *fl, int datum)
1140-
{
1141-
fl->list = lappend_int(fl->list, datum);
1142-
}
1143-
1144-
void FastAppendo(FastList *fl, Oid datum);
1145-
1146-
void
1147-
FastAppendo(FastList *fl, Oid datum)
1148-
{
1149-
fl->list = lappend_oid(fl->list, datum);
1150-
}
1151-
1152-
void FastConc(FastList *fl, List *cells);
1153-
1154-
void
1155-
FastConc(FastList *fl, List *cells)
1156-
{
1157-
fl->list = list_concat(fl->list, cells);
1158-
}
1159-
1160-
void FastConcFast(FastList *fl1, FastList *fl2);
1161-
1162-
void
1163-
FastConcFast(FastList *fl1, FastList *fl2)
1164-
{
1165-
fl1->list = list_concat(fl1->list, fl2->list);
1166-
}

src/include/nodes/pg_list.h

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,9 @@
33
* pg_list.h
44
* interface for PostgreSQL generic linked list package
55
*
6+
* This package implements singly-linked homogeneous lists.
67
*
7-
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
8-
* Portions Copyright (c) 1994, Regents of the University of California
9-
*
10-
* $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.46 2004/05/30 23:40:39 neilc Exp $
11-
*
12-
*-------------------------------------------------------------------------
13-
*/
14-
#ifndef PG_LIST_H
15-
#define PG_LIST_H
16-
17-
#include "nodes/nodes.h"
18-
19-
/*
20-
* This package implements singly-linked homogeneous lists. It is
21-
* important to have constant-time length, append, and prepend
8+
* It is important to have constant-time length, append, and prepend
229
* operations. To achieve this, we deal with two distinct data
2310
* structures:
2411
*
@@ -38,7 +25,20 @@
3825
*
3926
* (At the moment, ints and Oids are the same size, but they may not
4027
* always be so; try to be careful to maintain the distinction.)
28+
*
29+
*
30+
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
31+
* Portions Copyright (c) 1994, Regents of the University of California
32+
*
33+
* $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.47 2004/06/01 06:02:13 tgl Exp $
34+
*
35+
*-------------------------------------------------------------------------
4136
*/
37+
#ifndef PG_LIST_H
38+
#define PG_LIST_H
39+
40+
#include "nodes/nodes.h"
41+
4242

4343
typedef struct ListCell ListCell;
4444

@@ -107,7 +107,7 @@ extern int list_length(List *l);
107107
* the List API: the macro lfirst() was used to mean "the data in this
108108
* cons cell". To avoid changing every usage of lfirst(), that meaning
109109
* has been kept. As a result, lfirst() takes a ListCell and returns
110-
* the data it contains; to get the data in the _first_ cell of a
110+
* the data it contains; to get the data in the first cell of a
111111
* List, use linitial(). Worse, lsecond() is more closely related to
112112
* linitial() than lfirst(): given a List, lsecond() returns the data
113113
* in the second cons cell.
@@ -122,10 +122,6 @@ extern int list_length(List *l);
122122
#define linitial_int(l) lfirst_int(list_head(l))
123123
#define linitial_oid(l) lfirst_oid(list_head(l))
124124

125-
#define llast(l) lfirst(list_tail(l))
126-
#define llast_int(l) lfirst_int(list_tail(l))
127-
#define llast_oid(l) lfirst_oid(list_tail(l))
128-
129125
#define lsecond(l) lfirst(lnext(list_head(l)))
130126
#define lsecond_int(l) lfirst_int(lnext(list_head(l)))
131127
#define lsecond_oid(l) lfirst_oid(lnext(list_head(l)))
@@ -138,6 +134,10 @@ extern int list_length(List *l);
138134
#define lfourth_int(l) lfirst_int(lnext(lnext(lnext(list_head(l)))))
139135
#define lfourth_oid(l) lfirst_oid(lnext(lnext(lnext(list_head(l)))))
140136

137+
#define llast(l) lfirst(list_tail(l))
138+
#define llast_int(l) lfirst_int(list_tail(l))
139+
#define llast_oid(l) lfirst_oid(list_tail(l))
140+
141141
/*
142142
* Convenience macros for building fixed-length lists
143143
*/
@@ -301,19 +301,4 @@ extern int length(List *list);
301301

302302
#endif /* ENABLE_LIST_COMPAT */
303303

304-
typedef struct FastList
305-
{
306-
List *list;
307-
} FastList;
308-
309-
extern void FastListInit(FastList *fl);
310-
extern void FastListFromList(FastList *fl, List *list);
311-
extern List *FastListValue(FastList *fl);
312-
extern void makeFastList1(FastList *fl, void *elem);
313-
extern void FastAppend(FastList *fl, void *datum);
314-
extern void FastAppendi(FastList *fl, int datum);
315-
extern void FastAppendo(FastList *fl, Oid datum);
316-
extern void FastConc(FastList *fl, List *cells);
317-
extern void FastConcFast(FastList *fl1, FastList *fl2);
318-
319304
#endif /* PG_LIST_H */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy