aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/bitmapset.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-03-02 11:34:29 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2023-03-02 11:34:29 -0500
commit462bb7f12851c215dfc21a88ae0ed4bf7fcb36a3 (patch)
tree1ab5f6429f5833fd548c1eb079d6129339acb077 /src/backend/nodes/bitmapset.c
parent2f80c95740f88e9e3e04ee0c2063e55a497315b4 (diff)
downloadpostgresql-462bb7f12851c215dfc21a88ae0ed4bf7fcb36a3.tar.gz
postgresql-462bb7f12851c215dfc21a88ae0ed4bf7fcb36a3.zip
Remove bms_first_member().
This function has been semi-deprecated ever since we invented bms_next_member(). Its habit of scribbling on the input bitmapset isn't great, plus for sufficiently large bitmapsets it would take O(N^2) time to complete a loop. Now we have the additional problem that reducing the input to empty while leaving it still accessible would violate a planned invariant. So let's just get rid of it, after updating the few extant callers to use bms_next_member(). Patch by me; thanks to Nathan Bossart and Richard Guo for review. Discussion: https://postgr.es/m/1159933.1677621588@sss.pgh.pa.us
Diffstat (limited to 'src/backend/nodes/bitmapset.c')
-rw-r--r--src/backend/nodes/bitmapset.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/backend/nodes/bitmapset.c b/src/backend/nodes/bitmapset.c
index 98660524ade..10dbbdddf58 100644
--- a/src/backend/nodes/bitmapset.c
+++ b/src/backend/nodes/bitmapset.c
@@ -983,48 +983,6 @@ bms_join(Bitmapset *a, Bitmapset *b)
}
/*
- * bms_first_member - find and remove first member of a set
- *
- * Returns -1 if set is empty. NB: set is destructively modified!
- *
- * This is intended as support for iterating through the members of a set.
- * The typical pattern is
- *
- * while ((x = bms_first_member(inputset)) >= 0)
- * process member x;
- *
- * CAUTION: this destroys the content of "inputset". If the set must
- * not be modified, use bms_next_member instead.
- */
-int
-bms_first_member(Bitmapset *a)
-{
- int nwords;
- int wordnum;
-
- if (a == NULL)
- return -1;
- nwords = a->nwords;
- for (wordnum = 0; wordnum < nwords; wordnum++)
- {
- bitmapword w = a->words[wordnum];
-
- if (w != 0)
- {
- int result;
-
- w = RIGHTMOST_ONE(w);
- a->words[wordnum] &= ~w;
-
- result = wordnum * BITS_PER_BITMAPWORD;
- result += bmw_rightmost_one_pos(w);
- return result;
- }
- }
- return -1;
-}
-
-/*
* bms_next_member - find next member of a set
*
* Returns smallest member greater than "prevbit", or -2 if there is none.