more cleanup
This commit is contained in:
parent
1ed5cbbfd8
commit
ceb233ed11
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.18 1999/02/22 05:26:18 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.19 1999/02/22 06:08:47 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* XXX a few of the following functions are duplicated to handle
|
* XXX a few of the following functions are duplicated to handle
|
||||||
|
@ -29,6 +29,11 @@
|
||||||
#include "utils/elog.h"
|
#include "utils/elog.h"
|
||||||
#include "utils/palloc.h"
|
#include "utils/palloc.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* makeList
|
||||||
|
*
|
||||||
|
* Take varargs, terminated by -1, and make a List
|
||||||
|
*/
|
||||||
List *
|
List *
|
||||||
makeList(void *elem,...)
|
makeList(void *elem,...)
|
||||||
{
|
{
|
||||||
|
@ -57,6 +62,11 @@ makeList(void *elem,...)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* lcons
|
||||||
|
*
|
||||||
|
* Add obj to the front of list, or make a new list if 'list' is NIL
|
||||||
|
*/
|
||||||
List *
|
List *
|
||||||
lcons(void *obj, List *list)
|
lcons(void *obj, List *list)
|
||||||
{
|
{
|
||||||
|
@ -67,6 +77,11 @@ lcons(void *obj, List *list)
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* lconsi
|
||||||
|
*
|
||||||
|
* Same as lcons, but for integer data
|
||||||
|
*/
|
||||||
List *
|
List *
|
||||||
lconsi(int datum, List *list)
|
lconsi(int datum, List *list)
|
||||||
{
|
{
|
||||||
|
@ -77,18 +92,35 @@ lconsi(int datum, List *list)
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* lappend
|
||||||
|
*
|
||||||
|
* Add obj to the end of list, or make a new list if 'list' is NIL
|
||||||
|
*
|
||||||
|
* MORE EXPENSIVE THAN lcons
|
||||||
|
*/
|
||||||
List *
|
List *
|
||||||
lappend(List *list, void *obj)
|
lappend(List *list, void *obj)
|
||||||
{
|
{
|
||||||
return nconc(list, lcons(obj, NIL));
|
return nconc(list, lcons(obj, NIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* lappendi
|
||||||
|
*
|
||||||
|
* Same as lappend, but for integers
|
||||||
|
*/
|
||||||
List *
|
List *
|
||||||
lappendi(List *list, int datum)
|
lappendi(List *list, int datum)
|
||||||
{
|
{
|
||||||
return nconc(list, lconsi(datum, NIL));
|
return nconc(list, lconsi(datum, NIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nconc
|
||||||
|
*
|
||||||
|
* Concat l2 on to the end of l1
|
||||||
|
*/
|
||||||
List *
|
List *
|
||||||
nconc(List *l1, List *l2)
|
nconc(List *l1, List *l2)
|
||||||
{
|
{
|
||||||
|
@ -131,6 +163,9 @@ nreverse(List *list)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* makeInteger
|
||||||
|
*/
|
||||||
Value *
|
Value *
|
||||||
makeInteger(long i)
|
makeInteger(long i)
|
||||||
{
|
{
|
||||||
|
@ -141,6 +176,9 @@ makeInteger(long i)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* makeFloat
|
||||||
|
*/
|
||||||
Value *
|
Value *
|
||||||
makeFloat(double d)
|
makeFloat(double d)
|
||||||
{
|
{
|
||||||
|
@ -151,6 +189,9 @@ makeFloat(double d)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* makeString
|
||||||
|
*/
|
||||||
Value *
|
Value *
|
||||||
makeString(char *str)
|
makeString(char *str)
|
||||||
{
|
{
|
||||||
|
@ -161,7 +202,11 @@ makeString(char *str)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* n starts with 0 */
|
/*
|
||||||
|
* nth
|
||||||
|
*
|
||||||
|
* Get the n'th element of the list. First element is 0th.
|
||||||
|
*/
|
||||||
void *
|
void *
|
||||||
nth(int n, List *l)
|
nth(int n, List *l)
|
||||||
{
|
{
|
||||||
|
@ -174,6 +219,11 @@ nth(int n, List *l)
|
||||||
return lfirst(l);
|
return lfirst(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nthi
|
||||||
|
*
|
||||||
|
* Same as nthi, but for integers
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
nthi(int n, List *l)
|
nthi(int n, List *l)
|
||||||
{
|
{
|
||||||
|
@ -200,6 +250,11 @@ set_nth(List *l, int n, void *elem)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* length
|
||||||
|
*
|
||||||
|
* Get the length of l
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
length(List *l)
|
length(List *l)
|
||||||
{
|
{
|
||||||
|
@ -213,6 +268,11 @@ length(List *l)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* freeList
|
||||||
|
*
|
||||||
|
* Free the List nodes of a list
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
freeList(List *list)
|
freeList(List *list)
|
||||||
{
|
{
|
||||||
|
@ -415,6 +475,9 @@ lremove(void *elem, List *list)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* LispRemove
|
||||||
|
*/
|
||||||
List *
|
List *
|
||||||
LispRemove(void *elem, List *list)
|
LispRemove(void *elem, List *list)
|
||||||
{
|
{
|
||||||
|
@ -466,6 +529,11 @@ intLispRemove(int elem, List *list)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set_difference
|
||||||
|
*
|
||||||
|
* Return l1 without the elements in l2.
|
||||||
|
*/
|
||||||
List *
|
List *
|
||||||
set_difference(List *l1, List *l2)
|
set_difference(List *l1, List *l2)
|
||||||
{
|
{
|
||||||
|
@ -483,6 +551,11 @@ set_difference(List *l1, List *l2)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set_differencei
|
||||||
|
*
|
||||||
|
* Same as set_difference, but for integers
|
||||||
|
*/
|
||||||
List *
|
List *
|
||||||
set_differencei(List *l1, List *l2)
|
set_differencei(List *l1, List *l2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.31 1999/02/22 05:26:20 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.32 1999/02/22 06:08:48 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +61,7 @@ make_rels_by_joins(Query *root, List *old_rels)
|
||||||
*/
|
*/
|
||||||
joined_rels = make_rels_by_clauseless_joins(old_rel,
|
joined_rels = make_rels_by_clauseless_joins(old_rel,
|
||||||
root->base_rel_list);
|
root->base_rel_list);
|
||||||
joined_rels = append(joined_rels,
|
joined_rels = nconc(joined_rels,
|
||||||
make_rels_by_clauseless_joins(old_rel,
|
make_rels_by_clauseless_joins(old_rel,
|
||||||
old_rels));
|
old_rels));
|
||||||
}
|
}
|
||||||
|
@ -236,10 +236,10 @@ make_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *joininfo)
|
||||||
joinrel->restrictinfo = joininfo->jinfo_restrictinfo;
|
joinrel->restrictinfo = joininfo->jinfo_restrictinfo;
|
||||||
|
|
||||||
joinrel_joininfo_list = new_joininfo_list(
|
joinrel_joininfo_list = new_joininfo_list(
|
||||||
append(outer_rel->joininfo,
|
nconc(copyObject(outer_rel->joininfo),
|
||||||
inner_rel->joininfo),
|
copyObject(inner_rel->joininfo)),
|
||||||
nconc(listCopy(outer_rel->relids),
|
nconc(listCopy(outer_rel->relids),
|
||||||
listCopy(inner_rel->relids)));
|
listCopy(inner_rel->relids)));
|
||||||
|
|
||||||
joinrel->joininfo = joinrel_joininfo_list;
|
joinrel->joininfo = joinrel_joininfo_list;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue