Skip to content

Commit c77f6f5

Browse files
committed
Fix cases of discarding result from list API functions
Two cases violated list APIs by throwing away the return value. While the code was technically correct, it relied on internal knowledge of the list implementation, and the code wasn't really gaining anything that way. It is planned to make this a compiler warning in the future, so just fix these cases by assigning the return value properly. Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://www.postgresql.org/message-id/flat/e3753562-99cd-b65f-5aca-687dfd1ec2fc@2ndquadrant.com
1 parent ec29427 commit c77f6f5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/backend/commands/lockcmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ LockViewRecurse(Oid reloid, LOCKMODE lockmode, bool nowait,
266266

267267
LockViewRecurse_walker((Node *) viewquery, &context);
268268

269-
(void) list_delete_last(context.ancestor_views);
269+
context.ancestor_views = list_delete_last(context.ancestor_views);
270270

271271
table_close(view, NoLock);
272272
}

src/backend/parser/analyze.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,8 +1475,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
14751475
Node *col = (Node *) lfirst(lc);
14761476
List *sublist = lfirst(lc2);
14771477

1478-
/* sublist pointer in exprsLists won't need adjustment */
1479-
(void) lappend(sublist, col);
1478+
sublist = lappend(sublist, col);
14801479
}
14811480
list_free(colexprs[i]);
14821481
}

0 commit comments

Comments
 (0)