summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/file_fdw/file_fdw.c9
-rw-r--r--contrib/pg_trgm/trgm_regexp.c18
-rw-r--r--contrib/postgres_fdw/deparse.c6
-rw-r--r--contrib/sepgsql/label.c11
-rw-r--r--contrib/sepgsql/uavc.c9
5 files changed, 14 insertions, 39 deletions
diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c
index 412dcabe55e..549821ca84c 100644
--- a/contrib/file_fdw/file_fdw.c
+++ b/contrib/file_fdw/file_fdw.c
@@ -360,8 +360,7 @@ fileGetOptions(Oid foreigntableid,
ForeignServer *server;
ForeignDataWrapper *wrapper;
List *options;
- ListCell *lc,
- *prev;
+ ListCell *lc;
/*
* Extract options from FDW objects. We ignore user mappings because
@@ -387,7 +386,6 @@ fileGetOptions(Oid foreigntableid,
*/
*filename = NULL;
*is_program = false;
- prev = NULL;
foreach(lc, options)
{
DefElem *def = (DefElem *) lfirst(lc);
@@ -395,17 +393,16 @@ fileGetOptions(Oid foreigntableid,
if (strcmp(def->defname, "filename") == 0)
{
*filename = defGetString(def);
- options = list_delete_cell(options, lc, prev);
+ options = foreach_delete_current(options, lc);
break;
}
else if (strcmp(def->defname, "program") == 0)
{
*filename = defGetString(def);
*is_program = true;
- options = list_delete_cell(options, lc, prev);
+ options = foreach_delete_current(options, lc);
break;
}
- prev = lc;
}
/*
diff --git a/contrib/pg_trgm/trgm_regexp.c b/contrib/pg_trgm/trgm_regexp.c
index c239d8cea6e..3ad5731ae80 100644
--- a/contrib/pg_trgm/trgm_regexp.c
+++ b/contrib/pg_trgm/trgm_regexp.c
@@ -1013,9 +1013,7 @@ addKey(TrgmNFA *trgmNFA, TrgmState *state, TrgmStateKey *key)
{
regex_arc_t *arcs;
TrgmStateKey destKey;
- ListCell *cell,
- *prev,
- *next;
+ ListCell *cell;
int i,
arcsCount;
@@ -1030,13 +1028,10 @@ addKey(TrgmNFA *trgmNFA, TrgmState *state, TrgmStateKey *key)
* redundancy. We can drop either old key(s) or the new key if we find
* redundancy.
*/
- prev = NULL;
- cell = list_head(state->enterKeys);
- while (cell)
+ foreach(cell, state->enterKeys)
{
TrgmStateKey *existingKey = (TrgmStateKey *) lfirst(cell);
- next = lnext(cell);
if (existingKey->nstate == key->nstate)
{
if (prefixContains(&existingKey->prefix, &key->prefix))
@@ -1050,15 +1045,10 @@ addKey(TrgmNFA *trgmNFA, TrgmState *state, TrgmStateKey *key)
* The new key covers this old key. Remove the old key, it's
* no longer needed once we add this key to the list.
*/
- state->enterKeys = list_delete_cell(state->enterKeys,
- cell, prev);
+ state->enterKeys = foreach_delete_current(state->enterKeys,
+ cell);
}
- else
- prev = cell;
}
- else
- prev = cell;
- cell = next;
}
/* No redundancy, so add this key to the state's list */
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index b951b11592e..548ae66119b 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -2610,7 +2610,7 @@ deparseSubscriptingRef(SubscriptingRef *node, deparse_expr_cxt *context)
{
deparseExpr(lfirst(lowlist_item), context);
appendStringInfoChar(buf, ':');
- lowlist_item = lnext(lowlist_item);
+ lowlist_item = lnext(node->reflowerindexpr, lowlist_item);
}
deparseExpr(lfirst(uplist_item), context);
appendStringInfoChar(buf, ']');
@@ -2673,7 +2673,7 @@ deparseFuncExpr(FuncExpr *node, deparse_expr_cxt *context)
{
if (!first)
appendStringInfoString(buf, ", ");
- if (use_variadic && lnext(arg) == NULL)
+ if (use_variadic && lnext(node->args, arg) == NULL)
appendStringInfoString(buf, "VARIADIC ");
deparseExpr((Expr *) lfirst(arg), context);
first = false;
@@ -3001,7 +3001,7 @@ deparseAggref(Aggref *node, deparse_expr_cxt *context)
first = false;
/* Add VARIADIC */
- if (use_variadic && lnext(arg) == NULL)
+ if (use_variadic && lnext(node->args, arg) == NULL)
appendStringInfoString(buf, "VARIADIC ");
deparseExpr((Expr *) n, context);
diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c
index 1d17d5a0c04..2b6a4150931 100644
--- a/contrib/sepgsql/label.c
+++ b/contrib/sepgsql/label.c
@@ -207,23 +207,16 @@ sepgsql_subxact_callback(SubXactEvent event, SubTransactionId mySubid,
SubTransactionId parentSubid, void *arg)
{
ListCell *cell;
- ListCell *prev;
- ListCell *next;
if (event == SUBXACT_EVENT_ABORT_SUB)
{
- prev = NULL;
- for (cell = list_head(client_label_pending); cell; cell = next)
+ foreach(cell, client_label_pending)
{
pending_label *plabel = lfirst(cell);
- next = lnext(cell);
-
if (plabel->subid == mySubid)
client_label_pending
- = list_delete_cell(client_label_pending, cell, prev);
- else
- prev = cell;
+ = foreach_delete_current(client_label_pending, cell);
}
}
}
diff --git a/contrib/sepgsql/uavc.c b/contrib/sepgsql/uavc.c
index 7d94c31e56e..60fcf996539 100644
--- a/contrib/sepgsql/uavc.c
+++ b/contrib/sepgsql/uavc.c
@@ -93,24 +93,20 @@ static void
sepgsql_avc_reclaim(void)
{
ListCell *cell;
- ListCell *next;
- ListCell *prev;
int index;
while (avc_num_caches >= avc_threshold - AVC_NUM_RECLAIM)
{
index = avc_lru_hint;
- prev = NULL;
- for (cell = list_head(avc_slots[index]); cell; cell = next)
+ foreach(cell, avc_slots[index])
{
avc_cache *cache = lfirst(cell);
- next = lnext(cell);
if (!cache->hot_cache)
{
avc_slots[index]
- = list_delete_cell(avc_slots[index], cell, prev);
+ = foreach_delete_current(avc_slots[index], cell);
pfree(cache->scontext);
pfree(cache->tcontext);
@@ -123,7 +119,6 @@ sepgsql_avc_reclaim(void)
else
{
cache->hot_cache = false;
- prev = cell;
}
}
avc_lru_hint = (avc_lru_hint + 1) % AVC_NUM_SLOTS;