Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ba0f38d6
Commit
ba0f38d6
authored
Jun 01, 2004
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FastList is history, yay.
parent
aad41967
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
114 deletions
+24
-114
src/backend/nodes/list.c
src/backend/nodes/list.c
+4
-79
src/include/nodes/pg_list.h
src/include/nodes/pg_list.h
+20
-35
No files found.
src/backend/nodes/list.c
View file @
ba0f38d6
...
...
@@ -9,13 +9,15 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.5
8 2004/05/30 23:40:27 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.5
9 2004/06/01 06:02:12 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "nodes/pg_list.h"
/*
* Routines to simplify writing assertions about the type of a list; a
* NIL list is considered to be an empty list of any type.
...
...
@@ -1069,7 +1071,7 @@ list_length(List *l)
*
* 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
* 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.
*/
...
...
@@ -1087,80 +1089,3 @@ length(List *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
);
}
src/include/nodes/pg_list.h
View file @
ba0f38d6
...
...
@@ -3,22 +3,9 @@
* pg_list.h
* interface for PostgreSQL generic linked list package
*
* This package implements singly-linked homogeneous lists.
*
* 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.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
* It is important to have constant-time length, append, and prepend
* operations. To achieve this, we deal with two distinct data
* structures:
*
...
...
@@ -38,7 +25,20 @@
*
* (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.)
*
*
* 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
;
...
...
@@ -107,7 +107,7 @@ extern int list_length(List *l);
* 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
* 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
* linitial() than lfirst(): given a List, lsecond() returns the data
* in the second cons cell.
...
...
@@ -122,10 +122,6 @@ 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)))
...
...
@@ -138,6 +134,10 @@ extern int list_length(List *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 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
*/
...
...
@@ -301,19 +301,4 @@ extern int length(List *list);
#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 */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment