Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Remove unnecessary casts of makeNode() result
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 23 Dec 2016 17:00:00 +0000 (12:00 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 23 Dec 2016 18:17:20 +0000 (13:17 -0500)
makeNode() is already a macro that has the right result pointer type, so
casting it again to the same type is unnecessary.

src/backend/commands/tablecmds.c
src/backend/executor/execQual.c
src/backend/replication/repl_gram.y
src/backend/rewrite/rowsecurity.c

index 13b12f1903530b0d7989e10975e924fa846295c1..0e7601fd94221bb6516291e218136631a32bc430 100644 (file)
@@ -12743,7 +12743,7 @@ transformPartitionSpec(Relation rel, PartitionSpec *partspec, char *strategy)
    RangeTblEntry *rte;
    ListCell   *l;
 
-   newspec = (PartitionSpec *) makeNode(PartitionSpec);
+   newspec = makeNode(PartitionSpec);
 
    newspec->strategy = partspec->strategy;
    newspec->location = partspec->location;
index ab09691fb207642cd70927425841321fdf51fb81..ec1ca01c5aa6089b5d1fd9668b65ef86875978a4 100644 (file)
@@ -4594,16 +4594,16 @@ ExecInitExpr(Expr *node, PlanState *parent)
            }
            else
            {
-               state = (ExprState *) makeNode(ExprState);
+               state = makeNode(ExprState);
                state->evalfunc = ExecEvalScalarVar;
            }
            break;
        case T_Const:
-           state = (ExprState *) makeNode(ExprState);
+           state = makeNode(ExprState);
            state->evalfunc = ExecEvalConst;
            break;
        case T_Param:
-           state = (ExprState *) makeNode(ExprState);
+           state = makeNode(ExprState);
            switch (((Param *) node)->paramkind)
            {
                case PARAM_EXEC:
@@ -4619,11 +4619,11 @@ ExecInitExpr(Expr *node, PlanState *parent)
            }
            break;
        case T_CoerceToDomainValue:
-           state = (ExprState *) makeNode(ExprState);
+           state = makeNode(ExprState);
            state->evalfunc = ExecEvalCoerceToDomainValue;
            break;
        case T_CaseTestExpr:
-           state = (ExprState *) makeNode(ExprState);
+           state = makeNode(ExprState);
            state->evalfunc = ExecEvalCaseTestExpr;
            break;
        case T_Aggref:
@@ -5176,7 +5176,7 @@ ExecInitExpr(Expr *node, PlanState *parent)
            }
            break;
        case T_SQLValueFunction:
-           state = (ExprState *) makeNode(ExprState);
+           state = makeNode(ExprState);
            state->evalfunc = ExecEvalSQLValueFunction;
            break;
        case T_XmlExpr:
@@ -5250,7 +5250,7 @@ ExecInitExpr(Expr *node, PlanState *parent)
            }
            break;
        case T_CurrentOfExpr:
-           state = (ExprState *) makeNode(ExprState);
+           state = makeNode(ExprState);
            state->evalfunc = ExecEvalCurrentOfExpr;
            break;
        case T_TargetEntry:
index e75516c8d2574925b01d71de600f42e2014bd09f..8cc9edd229fb0672b907e6fe4eac10441937e7ea 100644 (file)
@@ -131,8 +131,7 @@ identify_system:
 base_backup:
            K_BASE_BACKUP base_backup_opt_list
                {
-                   BaseBackupCmd *cmd =
-                       (BaseBackupCmd *) makeNode(BaseBackupCmd);
+                   BaseBackupCmd *cmd = makeNode(BaseBackupCmd);
                    cmd->options = $2;
                    $$ = (Node *) cmd;
                }
index e38586dd80baf573ba460b452db73a4ca31340f9..53b27d1137020cee1eddfca6ea03da267717182f 100644 (file)
@@ -703,7 +703,7 @@ add_with_check_options(Relation rel,
         */
        WithCheckOption *wco;
 
-       wco = (WithCheckOption *) makeNode(WithCheckOption);
+       wco = makeNode(WithCheckOption);
        wco->kind = kind;
        wco->relname = pstrdup(RelationGetRelationName(rel));
        wco->polname = NULL;
@@ -735,7 +735,7 @@ add_with_check_options(Relation rel,
                qual = copyObject(qual);
                ChangeVarNodes((Node *) qual, 1, rt_index, 0);
 
-               wco = (WithCheckOption *) makeNode(WithCheckOption);
+               wco = makeNode(WithCheckOption);
                wco->kind = kind;
                wco->relname = pstrdup(RelationGetRelationName(rel));
                wco->polname = pstrdup(policy->policy_name);
@@ -755,7 +755,7 @@ add_with_check_options(Relation rel,
         */
        WithCheckOption *wco;
 
-       wco = (WithCheckOption *) makeNode(WithCheckOption);
+       wco = makeNode(WithCheckOption);
        wco->kind = kind;
        wco->relname = pstrdup(RelationGetRelationName(rel));
        wco->polname = NULL;