Commit e2aec508 authored by Bruce Momjian's avatar Bruce Momjian

Replace foo/bar to l1/l2.

parent d370849a
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.7 1997/09/08 21:44:04 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.8 1997/12/19 16:54:15 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
...@@ -278,19 +278,19 @@ nreverse(List *list) ...@@ -278,19 +278,19 @@ nreverse(List *list)
* XXX only good for IntList -ay * XXX only good for IntList -ay
*/ */
bool bool
same(List *foo, List *bar) same(List *l1, List *l2)
{ {
List *temp = NIL; List *temp = NIL;
if (foo == NULL) if (l1 == NULL)
return (bar == NULL); return (l2 == NULL);
if (bar == NULL) if (l2 == NULL)
return (foo == NULL); return (l1 == NULL);
if (length(foo) == length(bar)) if (length(l1) == length(l2))
{ {
foreach(temp, foo) foreach(temp, l1)
{ {
if (!intMember(lfirsti(temp), bar)) if (!intMember(lfirsti(temp), l2))
return (false); return (false);
} }
return (true); return (true);
...@@ -300,21 +300,21 @@ same(List *foo, List *bar) ...@@ -300,21 +300,21 @@ same(List *foo, List *bar)
} }
List * List *
LispUnion(List *foo, List *bar) LispUnion(List *l1, List *l2)
{ {
List *retval = NIL; List *retval = NIL;
List *i = NIL; List *i = NIL;
List *j = NIL; List *j = NIL;
if (foo == NIL) if (l1 == NIL)
return (bar); /* XXX - should be copy of bar */ return (l2); /* XXX - should be copy of l2 */
if (bar == NIL) if (l2 == NIL)
return (foo); /* XXX - should be copy of foo */ return (l1); /* XXX - should be copy of l1 */
foreach(i, foo) foreach(i, l1)
{ {
foreach(j, bar) foreach(j, l2)
{ {
if (!equal(lfirst(i), lfirst(j))) if (!equal(lfirst(i), lfirst(j)))
{ {
...@@ -323,7 +323,7 @@ LispUnion(List *foo, List *bar) ...@@ -323,7 +323,7 @@ LispUnion(List *foo, List *bar)
} }
} }
} }
foreach(i, bar) foreach(i, l2)
{ {
retval = lappend(retval, lfirst(i)); retval = lappend(retval, lfirst(i));
} }
...@@ -332,21 +332,21 @@ LispUnion(List *foo, List *bar) ...@@ -332,21 +332,21 @@ LispUnion(List *foo, List *bar)
} }
List * List *
LispUnioni(List *foo, List *bar) LispUnioni(List *l1, List *l2)
{ {
List *retval = NIL; List *retval = NIL;
List *i = NIL; List *i = NIL;
List *j = NIL; List *j = NIL;
if (foo == NIL) if (l1 == NIL)
return (bar); /* XXX - should be copy of bar */ return (l2); /* XXX - should be copy of l2 */
if (bar == NIL) if (l2 == NIL)
return (foo); /* XXX - should be copy of foo */ return (l1); /* XXX - should be copy of l1 */
foreach(i, foo) foreach(i, l1)
{ {
foreach(j, bar) foreach(j, l2)
{ {
if (lfirsti(i) != lfirsti(j)) if (lfirsti(i) != lfirsti(j))
{ {
...@@ -355,7 +355,7 @@ LispUnioni(List *foo, List *bar) ...@@ -355,7 +355,7 @@ LispUnioni(List *foo, List *bar)
} }
} }
} }
foreach(i, bar) foreach(i, l2)
{ {
retval = lappendi(retval, lfirsti(i)); retval = lappendi(retval, lfirsti(i));
} }
...@@ -365,27 +365,27 @@ LispUnioni(List *foo, List *bar) ...@@ -365,27 +365,27 @@ LispUnioni(List *foo, List *bar)
/* /*
* member() * member()
* - nondestructive, returns t iff foo is a member of the list * - nondestructive, returns t iff l1 is a member of the list
* bar * l2
*/ */
bool bool
member(void *foo, List *bar) member(void *l1, List *l2)
{ {
List *i; List *i;
foreach(i, bar) foreach(i, l2)
if (equal((Node *) (lfirst(i)), (Node *) foo)) if (equal((Node *) (lfirst(i)), (Node *) l1))
return (true); return (true);
return (false); return (false);
} }
bool bool
intMember(int foo, List *bar) intMember(int l1, List *l2)
{ {
List *i; List *i;
foreach(i, bar) foreach(i, l2)
if (foo == lfirsti(i)) if (l1 == lfirsti(i))
return (true); return (true);
return (false); return (false);
} }
...@@ -473,34 +473,34 @@ intLispRemove(int elem, List *list) ...@@ -473,34 +473,34 @@ intLispRemove(int elem, List *list)
#endif #endif
List * List *
set_difference(List *list1, List *list2) set_difference(List *l1, List *l2)
{ {
List *temp1 = NIL; List *temp1 = NIL;
List *result = NIL; List *result = NIL;
if (list2 == NIL) if (l2 == NIL)
return (list1); return (l1);
foreach(temp1, list1) foreach(temp1, l1)
{ {
if (!member(lfirst(temp1), list2)) if (!member(lfirst(temp1), l2))
result = lappend(result, lfirst(temp1)); result = lappend(result, lfirst(temp1));
} }
return (result); return (result);
} }
List * List *
set_differencei(List *list1, List *list2) set_differencei(List *l1, List *l2)
{ {
List *temp1 = NIL; List *temp1 = NIL;
List *result = NIL; List *result = NIL;
if (list2 == NIL) if (l2 == NIL)
return (list1); return (l1);
foreach(temp1, list1) foreach(temp1, l1)
{ {
if (!intMember(lfirsti(temp1), list2)) if (!intMember(lfirsti(temp1), l2))
result = lappendi(result, lfirsti(temp1)); result = lappendi(result, lfirsti(temp1));
} }
return (result); return (result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment