aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/nodes/list.c')
-rw-r--r--src/backend/nodes/list.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c
index d4684d3cc82..add172ec777 100644
--- a/src/backend/nodes/list.c
+++ b/src/backend/nodes/list.c
@@ -31,7 +31,7 @@
* Check that the specified List is valid (so far as we can tell).
*/
static void
-check_list_invariants(List *list)
+check_list_invariants(const List *list)
{
if (list == NIL)
return;
@@ -383,7 +383,7 @@ list_truncate(List *list, int new_size)
* failure if there is no such cell.
*/
static ListCell *
-list_nth_cell(List *list, int n)
+list_nth_cell(const List *list, int n)
{
ListCell *match;
@@ -407,7 +407,7 @@ list_nth_cell(List *list, int n)
* specified list. (List elements begin at 0.)
*/
void *
-list_nth(List *list, int n)
+list_nth(const List *list, int n)
{
Assert(IsPointerList(list));
return lfirst(list_nth_cell(list, n));
@@ -418,7 +418,7 @@ list_nth(List *list, int n)
* specified list.
*/
int
-list_nth_int(List *list, int n)
+list_nth_int(const List *list, int n)
{
Assert(IsIntegerList(list));
return lfirst_int(list_nth_cell(list, n));
@@ -429,7 +429,7 @@ list_nth_int(List *list, int n)
* list.
*/
Oid
-list_nth_oid(List *list, int n)
+list_nth_oid(const List *list, int n)
{
Assert(IsOidList(list));
return lfirst_oid(list_nth_cell(list, n));
@@ -441,9 +441,9 @@ list_nth_oid(List *list, int n)
* Node as 'datum'.
*/
bool
-list_member(List *list, void *datum)
+list_member(const List *list, const void *datum)
{
- ListCell *cell;
+ const ListCell *cell;
Assert(IsPointerList(list));
check_list_invariants(list);
@@ -462,9 +462,9 @@ list_member(List *list, void *datum)
* determined by using simple pointer comparison.
*/
bool
-list_member_ptr(List *list, void *datum)
+list_member_ptr(const List *list, const void *datum)
{
- ListCell *cell;
+ const ListCell *cell;
Assert(IsPointerList(list));
check_list_invariants(list);
@@ -482,9 +482,9 @@ list_member_ptr(List *list, void *datum)
* Return true iff the integer 'datum' is a member of the list.
*/
bool
-list_member_int(List *list, int datum)
+list_member_int(const List *list, int datum)
{
- ListCell *cell;
+ const ListCell *cell;
Assert(IsIntegerList(list));
check_list_invariants(list);
@@ -502,9 +502,9 @@ list_member_int(List *list, int datum)
* Return true iff the OID 'datum' is a member of the list.
*/
bool
-list_member_oid(List *list, Oid datum)
+list_member_oid(const List *list, Oid datum)
{
- ListCell *cell;
+ const ListCell *cell;
Assert(IsOidList(list));
check_list_invariants(list);
@@ -694,10 +694,10 @@ list_delete_first(List *list)
* performance bottleneck.
*/
List *
-list_union(List *list1, List *list2)
+list_union(const List *list1, const List *list2)
{
List *result;
- ListCell *cell;
+ const ListCell *cell;
Assert(IsPointerList(list1));
Assert(IsPointerList(list2));
@@ -718,10 +718,10 @@ list_union(List *list1, List *list2)
* pointer comparison.
*/
List *
-list_union_ptr(List *list1, List *list2)
+list_union_ptr(const List *list1, const List *list2)
{
List *result;
- ListCell *cell;
+ const ListCell *cell;
Assert(IsPointerList(list1));
Assert(IsPointerList(list2));
@@ -741,10 +741,10 @@ list_union_ptr(List *list1, List *list2)
* This variant of list_union() operates upon lists of integers.
*/
List *
-list_union_int(List *list1, List *list2)
+list_union_int(const List *list1, const List *list2)
{
List *result;
- ListCell *cell;
+ const ListCell *cell;
Assert(IsIntegerList(list1));
Assert(IsIntegerList(list2));
@@ -764,10 +764,10 @@ list_union_int(List *list1, List *list2)
* This variant of list_union() operates upon lists of OIDs.
*/
List *
-list_union_oid(List *list1, List *list2)
+list_union_oid(const List *list1, const List *list2)
{
List *result;
- ListCell *cell;
+ const ListCell *cell;
Assert(IsOidList(list1));
Assert(IsOidList(list2));
@@ -797,10 +797,10 @@ list_union_oid(List *list1, List *list2)
* to in the result.
*/
List *
-list_intersection(List *list1, List *list2)
+list_intersection(const List *list1, const List *list2)
{
List *result;
- ListCell *cell;
+ const ListCell *cell;
if (list1 == NIL || list2 == NIL)
return NIL;
@@ -829,9 +829,9 @@ list_intersection(List *list1, List *list2)
* membership via equal()
*/
List *
-list_difference(List *list1, List *list2)
+list_difference(const List *list1, const List *list2)
{
- ListCell *cell;
+ const ListCell *cell;
List *result = NIL;
Assert(IsPointerList(list1));
@@ -855,9 +855,9 @@ list_difference(List *list1, List *list2)
* simple pointer equality.
*/
List *
-list_difference_ptr(List *list1, List *list2)
+list_difference_ptr(const List *list1, const List *list2)
{
- ListCell *cell;
+ const ListCell *cell;
List *result = NIL;
Assert(IsPointerList(list1));
@@ -880,9 +880,9 @@ list_difference_ptr(List *list1, List *list2)
* This variant of list_difference() operates upon lists of integers.
*/
List *
-list_difference_int(List *list1, List *list2)
+list_difference_int(const List *list1, const List *list2)
{
- ListCell *cell;
+ const ListCell *cell;
List *result = NIL;
Assert(IsIntegerList(list1));
@@ -905,9 +905,9 @@ list_difference_int(List *list1, List *list2)
* This variant of list_difference() operates upon lists of OIDs.
*/
List *
-list_difference_oid(List *list1, List *list2)
+list_difference_oid(const List *list1, const List *list2)
{
- ListCell *cell;
+ const ListCell *cell;
List *result = NIL;
Assert(IsOidList(list1));
@@ -1131,7 +1131,7 @@ list_free_deep(List *list)
* Return a shallow copy of the specified list.
*/
List *
-list_copy(List *oldlist)
+list_copy(const List *oldlist)
{
List *newlist;
ListCell *newlist_prev;
@@ -1174,7 +1174,7 @@ list_copy(List *oldlist)
* Return a shallow copy of the specified list, without the first N elements.
*/
List *
-list_copy_tail(List *oldlist, int nskip)
+list_copy_tail(const List *oldlist, int nskip)
{
List *newlist;
ListCell *newlist_prev;
@@ -1230,7 +1230,7 @@ list_copy_tail(List *oldlist, int nskip)
#ifndef USE_INLINE
ListCell *
-list_head(List *l)
+list_head(const List *l)
{
return l ? l->head : NULL;
}
@@ -1242,7 +1242,7 @@ list_tail(List *l)
}
int
-list_length(List *l)
+list_length(const List *l)
{
return l ? l->length : 0;
}
@@ -1264,10 +1264,10 @@ list_length(List *l)
* list_length() macro in order to avoid the overhead of a function
* call.
*/
-int length(List *list);
+int length(const List *list);
int
-length(List *list)
+length(const List *list)
{
return list_length(list);
}