mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Cast result of copyObject() to correct type
copyObject() is declared to return void *, which allows easily assigning the result independent of the input, but it loses all type checking. If the compiler supports typeof or something similar, cast the result to the input type. This creates a greater amount of type safety. In some cases, where the result is assigned to a generic type such as Node * or Expr *, new casts are now necessary, but in general casts are now unnecessary in the normal case and indicate that something unusual is happening. Reviewed-by: Mark Dilger <hornschnorter@gmail.com>
This commit is contained in:
@ -349,8 +349,8 @@ rewriteRuleAction(Query *parsetree,
|
||||
* Make modifiable copies of rule action and qual (what we're passed are
|
||||
* the stored versions in the relcache; don't touch 'em!).
|
||||
*/
|
||||
rule_action = (Query *) copyObject(rule_action);
|
||||
rule_qual = (Node *) copyObject(rule_qual);
|
||||
rule_action = copyObject(rule_action);
|
||||
rule_qual = copyObject(rule_qual);
|
||||
|
||||
/*
|
||||
* Acquire necessary locks and fix any deleted JOIN RTE entries.
|
||||
@ -408,7 +408,7 @@ rewriteRuleAction(Query *parsetree,
|
||||
* that rule action's rtable is separate and shares no substructure with
|
||||
* the main rtable. Hence do a deep copy here.
|
||||
*/
|
||||
sub_action->rtable = list_concat((List *) copyObject(parsetree->rtable),
|
||||
sub_action->rtable = list_concat(copyObject(parsetree->rtable),
|
||||
sub_action->rtable);
|
||||
|
||||
/*
|
||||
@ -1897,7 +1897,7 @@ CopyAndAddInvertedQual(Query *parsetree,
|
||||
CmdType event)
|
||||
{
|
||||
/* Don't scribble on the passed qual (it's in the relcache!) */
|
||||
Node *new_qual = (Node *) copyObject(rule_qual);
|
||||
Node *new_qual = copyObject(rule_qual);
|
||||
acquireLocksOnSubLinks_context context;
|
||||
|
||||
context.for_execute = true;
|
||||
|
Reference in New Issue
Block a user