Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
ba0f38d6
Commit
ba0f38d6
authored
21 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
FastList is history, yay.
parent
aad41967
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/backend/nodes/list.c
+4
-79
4 additions, 79 deletions
src/backend/nodes/list.c
src/include/nodes/pg_list.h
+20
-35
20 additions, 35 deletions
src/include/nodes/pg_list.h
with
24 additions
and
114 deletions
src/backend/nodes/list.c
+
4
−
79
View file @
ba0f38d6
...
@@ -9,13 +9,15 @@
...
@@ -9,13 +9,15 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.5
8
2004/0
5/30 23:40:27 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.5
9
2004/0
6/01 06:02:12 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
#include
"postgres.h"
#include
"postgres.h"
#include
"nodes/pg_list.h"
#include
"nodes/pg_list.h"
/*
/*
* Routines to simplify writing assertions about the type of a list; a
* Routines to simplify writing assertions about the type of a list; a
* NIL list is considered to be an empty list of any type.
* NIL list is considered to be an empty list of any type.
...
@@ -1069,7 +1071,7 @@ list_length(List *l)
...
@@ -1069,7 +1071,7 @@ list_length(List *l)
*
*
* In order to avoid warnings for these function definitions, we need
* In order to avoid warnings for these function definitions, we need
* to include a prototype here as well as in pg_list.h. That's because
* to include a prototype here as well as in pg_list.h. That's because
* we
explicitly dis
able list API compatibility in list.c, so we
* we
don't en
able list API compatibility in list.c, so we
* don't see the prototypes for these functions.
* don't see the prototypes for these functions.
*/
*/
...
@@ -1087,80 +1089,3 @@ length(List *list)
...
@@ -1087,80 +1089,3 @@ length(List *list)
{
{
return
list_length
(
list
);
return
list_length
(
list
);
}
}
/*
* This code implements the old "Fast List" API, making use of the new
* List code to do so. There's no need for FastList anymore, so this
* code is a bit sloppy -- it will be removed soon.
*/
void
FastListInit
(
FastList
*
fl
);
void
FastListInit
(
FastList
*
fl
)
{
fl
->
list
=
NIL
;
}
void
FastListFromList
(
FastList
*
fl
,
List
*
l
);
void
FastListFromList
(
FastList
*
fl
,
List
*
list
)
{
fl
->
list
=
list
;
}
List
*
FastListValue
(
FastList
*
fl
);
List
*
FastListValue
(
FastList
*
fl
)
{
return
fl
->
list
;
}
void
makeFastList1
(
FastList
*
fl
,
void
*
elem
);
void
makeFastList1
(
FastList
*
fl
,
void
*
elem
)
{
fl
->
list
=
list_make1
(
elem
);
}
void
FastAppend
(
FastList
*
fl
,
void
*
datum
);
void
FastAppend
(
FastList
*
fl
,
void
*
datum
)
{
fl
->
list
=
lappend
(
fl
->
list
,
datum
);
}
void
FastAppendi
(
FastList
*
fl
,
int
datum
);
void
FastAppendi
(
FastList
*
fl
,
int
datum
)
{
fl
->
list
=
lappend_int
(
fl
->
list
,
datum
);
}
void
FastAppendo
(
FastList
*
fl
,
Oid
datum
);
void
FastAppendo
(
FastList
*
fl
,
Oid
datum
)
{
fl
->
list
=
lappend_oid
(
fl
->
list
,
datum
);
}
void
FastConc
(
FastList
*
fl
,
List
*
cells
);
void
FastConc
(
FastList
*
fl
,
List
*
cells
)
{
fl
->
list
=
list_concat
(
fl
->
list
,
cells
);
}
void
FastConcFast
(
FastList
*
fl1
,
FastList
*
fl2
);
void
FastConcFast
(
FastList
*
fl1
,
FastList
*
fl2
)
{
fl1
->
list
=
list_concat
(
fl1
->
list
,
fl2
->
list
);
}
This diff is collapsed.
Click to expand it.
src/include/nodes/pg_list.h
+
20
−
35
View file @
ba0f38d6
...
@@ -3,22 +3,9 @@
...
@@ -3,22 +3,9 @@
* pg_list.h
* pg_list.h
* interface for PostgreSQL generic linked list package
* interface for PostgreSQL generic linked list package
*
*
* This package implements singly-linked homogeneous lists.
*
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* It is important to have constant-time length, append, and prepend
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.46 2004/05/30 23:40:39 neilc Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PG_LIST_H
#define PG_LIST_H
#include
"nodes/nodes.h"
/*
* 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
* operations. To achieve this, we deal with two distinct data
* structures:
* structures:
*
*
...
@@ -38,7 +25,20 @@
...
@@ -38,7 +25,20 @@
*
*
* (At the moment, ints and Oids are the same size, but they may not
* (At the moment, ints and Oids are the same size, but they may not
* always be so; try to be careful to maintain the distinction.)
* always be so; try to be careful to maintain the distinction.)
*
*
* 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.47 2004/06/01 06:02:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*/
#ifndef PG_LIST_H
#define PG_LIST_H
#include
"nodes/nodes.h"
typedef
struct
ListCell
ListCell
;
typedef
struct
ListCell
ListCell
;
...
@@ -107,7 +107,7 @@ extern int list_length(List *l);
...
@@ -107,7 +107,7 @@ extern int list_length(List *l);
* the List API: the macro lfirst() was used to mean "the data in this
* the List API: the macro lfirst() was used to mean "the data in this
* cons cell". To avoid changing every usage of lfirst(), that meaning
* cons cell". To avoid changing every usage of lfirst(), that meaning
* has been kept. As a result, lfirst() takes a ListCell and returns
* has been kept. As a result, lfirst() takes a ListCell and returns
* the data it contains; to get the data in the
_
first
_
cell of a
* the data it contains; to get the data in the first cell of a
* List, use linitial(). Worse, lsecond() is more closely related to
* List, use linitial(). Worse, lsecond() is more closely related to
* linitial() than lfirst(): given a List, lsecond() returns the data
* linitial() than lfirst(): given a List, lsecond() returns the data
* in the second cons cell.
* in the second cons cell.
...
@@ -122,10 +122,6 @@ extern int list_length(List *l);
...
@@ -122,10 +122,6 @@ extern int list_length(List *l);
#define linitial_int(l) lfirst_int(list_head(l))
#define linitial_int(l) lfirst_int(list_head(l))
#define linitial_oid(l) lfirst_oid(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(l) lfirst(lnext(list_head(l)))
#define lsecond_int(l) lfirst_int(lnext(list_head(l)))
#define lsecond_int(l) lfirst_int(lnext(list_head(l)))
#define lsecond_oid(l) lfirst_oid(lnext(list_head(l)))
#define lsecond_oid(l) lfirst_oid(lnext(list_head(l)))
...
@@ -138,6 +134,10 @@ extern int list_length(List *l);
...
@@ -138,6 +134,10 @@ extern int list_length(List *l);
#define lfourth_int(l) lfirst_int(lnext(lnext(lnext(list_head(l)))))
#define lfourth_int(l) lfirst_int(lnext(lnext(lnext(list_head(l)))))
#define lfourth_oid(l) lfirst_oid(lnext(lnext(lnext(list_head(l)))))
#define lfourth_oid(l) lfirst_oid(lnext(lnext(lnext(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))
/*
/*
* Convenience macros for building fixed-length lists
* Convenience macros for building fixed-length lists
*/
*/
...
@@ -301,19 +301,4 @@ extern int length(List *list);
...
@@ -301,19 +301,4 @@ extern int length(List *list);
#endif
/* ENABLE_LIST_COMPAT */
#endif
/* ENABLE_LIST_COMPAT */
typedef
struct
FastList
{
List
*
list
;
}
FastList
;
extern
void
FastListInit
(
FastList
*
fl
);
extern
void
FastListFromList
(
FastList
*
fl
,
List
*
list
);
extern
List
*
FastListValue
(
FastList
*
fl
);
extern
void
makeFastList1
(
FastList
*
fl
,
void
*
elem
);
extern
void
FastAppend
(
FastList
*
fl
,
void
*
datum
);
extern
void
FastAppendi
(
FastList
*
fl
,
int
datum
);
extern
void
FastAppendo
(
FastList
*
fl
,
Oid
datum
);
extern
void
FastConc
(
FastList
*
fl
,
List
*
cells
);
extern
void
FastConcFast
(
FastList
*
fl1
,
FastList
*
fl2
);
#endif
/* PG_LIST_H */
#endif
/* PG_LIST_H */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment