I'm trying to change all the walkers and mutators to have a more
strict prototype. I had to do this with lots of casts.
I don't really like the idea of having all those generic pointer
types (Node * and void *), but currently see no better way to deal
with it.
I attached the patch.
Kurt
Index: src/backend/catalog/dependency.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/catalog/dependency.c,v
retrieving revision 1.34
diff -u -r1.34 dependency.c
--- src/backend/catalog/dependency.c 29 Nov 2003 19:51:42 -0000 1.34
+++ src/backend/catalog/dependency.c 12 Dec 2003 23:35:39 -0000
@@ -1117,14 +1117,15 @@
/* Examine substructure of query */
context->rtables = lcons(query->rtable, context->rtables);
result = query_tree_walker(query,
-
find_expr_references_walker,
- (void *) context,
-
QTW_IGNORE_JOINALIASES);
+ (bool (*)(Node *, void *))find_expr_references_walker,
+ context,
+ QTW_IGNORE_JOINALIASES);
context->rtables = lnext(context->rtables);
return result;
}
- return expression_tree_walker(node, find_expr_references_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *))find_expr_references_walker,
+ (void *) context);
}
/*
Index: src/backend/commands/tablecmds.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/tablecmds.c,v
retrieving revision 1.94
diff -u -r1.94 tablecmds.c
--- src/backend/commands/tablecmds.c 29 Nov 2003 19:51:47 -0000 1.94
+++ src/backend/commands/tablecmds.c 12 Dec 2003 23:35:49 -0000
@@ -854,8 +854,9 @@
}
return false;
}
- return expression_tree_walker(node, change_varattnos_walker,
- (void *) newattno);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) change_varattnos_walker,
+ (void *) newattno);
}
static bool
Index: src/backend/optimizer/path/costsize.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/optimizer/path/costsize.c,v
retrieving revision 1.117
diff -u -r1.117 costsize.c
--- src/backend/optimizer/path/costsize.c 3 Dec 2003 17:45:07 -0000 1.117
+++ src/backend/optimizer/path/costsize.c 12 Dec 2003 23:35:49 -0000
@@ -1614,8 +1614,9 @@
}
}
- return expression_tree_walker(node, cost_qual_eval_walker,
- (void *) total);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) cost_qual_eval_walker,
+ (void *) total);
}
Index: src/backend/optimizer/plan/setrefs.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/optimizer/plan/setrefs.c,v
retrieving revision 1.99
diff -u -r1.99 setrefs.c
--- src/backend/optimizer/plan/setrefs.c 29 Nov 2003 19:51:50 -0000 1.99
+++ src/backend/optimizer/plan/setrefs.c 12 Dec 2003 23:35:49 -0000
@@ -607,8 +607,8 @@
}
}
return expression_tree_mutator(node,
-
join_references_mutator,
- (void *) context);
+ (Node *(*)(Node *, void *)) join_references_mutator,
+ (void *) context);
}
/*
@@ -692,8 +692,8 @@
}
}
return expression_tree_mutator(node,
-
replace_vars_with_subplan_refs_mutator,
- (void *) context);
+ (Node *(*)(Node *, void *)) replace_vars_with_subplan_refs_mutator,
+ (void *) context);
}
/*****************************************************************************
Index: src/backend/optimizer/plan/subselect.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/optimizer/plan/subselect.c,v
retrieving revision 1.86
diff -u -r1.86 subselect.c
--- src/backend/optimizer/plan/subselect.c 29 Nov 2003 19:51:50 -0000 1.86
+++ src/backend/optimizer/plan/subselect.c 12 Dec 2003 23:35:49 -0000
@@ -857,8 +857,8 @@
locTopQual = false;
return expression_tree_mutator(node,
-
process_sublinks_mutator,
- (void *)
&locTopQual);
+ (Node *(*)(Node *, void *)) process_sublinks_mutator,
+ (void *) &locTopQual);
}
/*
@@ -1102,6 +1102,7 @@
context->outer_params));
/* fall through to recurse into subplan args */
}
- return expression_tree_walker(node, finalize_primnode,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) finalize_primnode,
+ (void *) context);
}
Index: src/backend/optimizer/prep/prepunion.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/optimizer/prep/prepunion.c,v
retrieving revision 1.105
diff -u -r1.105 prepunion.c
--- src/backend/optimizer/prep/prepunion.c 29 Nov 2003 19:51:51 -0000 1.105
+++ src/backend/optimizer/prep/prepunion.c 12 Dec 2003 23:35:50 -0000
@@ -777,9 +777,8 @@
Query *newnode;
newnode = query_tree_mutator((Query *) node,
-
adjust_inherited_attrs_mutator,
- (void *)
&context,
-
QTW_IGNORE_RT_SUBQUERIES);
+ (Node * (*)(Node *, void *)) adjust_inherited_attrs_mutator,
+ (void *) &context, QTW_IGNORE_RT_SUBQUERIES);
if (newnode->resultRelation == old_rt_index)
{
newnode->resultRelation = new_rt_index;
@@ -841,8 +840,8 @@
JoinExpr *j;
j = (JoinExpr *) expression_tree_mutator(node,
-
adjust_inherited_attrs_mutator,
-
(void *) context);
+ (Node *(*)(Node *, void *)) adjust_inherited_attrs_mutator,
+ (void *) context);
/* now fix JoinExpr's rtindex */
if (j->rtindex == context->old_rt_index)
j->rtindex = context->new_rt_index;
@@ -854,8 +853,8 @@
InClauseInfo *ininfo;
ininfo = (InClauseInfo *) expression_tree_mutator(node,
-
adjust_inherited_attrs_mutator,
-
(void *) context);
+ (Node *(*)(Node *, void *)) adjust_inherited_attrs_mutator,
+ (void *) context);
/* now fix InClauseInfo's relid sets */
ininfo->lefthand = adjust_relid_set(ininfo->lefthand,
context->old_rt_index,
@@ -930,8 +929,9 @@
SubPlan *subplan;
/* Copy the node and process subplan args */
- node = expression_tree_mutator(node, adjust_inherited_attrs_mutator,
- (void *)
context);
+ node = expression_tree_mutator(node,
+ (Node *(*)(Node *, void *)) adjust_inherited_attrs_mutator,
+ (void *) context);
/* Make sure we have separate copies of subplan and its rtable */
subplan = (SubPlan *) node;
subplan->plan = copyObject(subplan->plan);
@@ -939,8 +939,9 @@
return node;
}
- return expression_tree_mutator(node, adjust_inherited_attrs_mutator,
- (void *) context);
+ return expression_tree_mutator(node,
+ (Node *(*)(Node *, void *)) adjust_inherited_attrs_mutator,
+ (void *) context);
}
/*
Index: src/backend/optimizer/util/clauses.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/optimizer/util/clauses.c,v
retrieving revision 1.156
diff -u -r1.156 clauses.c
--- src/backend/optimizer/util/clauses.c 9 Dec 2003 01:56:20 -0000 1.156
+++ src/backend/optimizer/util/clauses.c 12 Dec 2003 23:35:51 -0000
@@ -416,8 +416,9 @@
return false;
}
Assert(!IsA(node, SubLink));
- return expression_tree_walker(node, count_agg_clause_walker,
- (void *) count);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) count_agg_clause_walker,
+ (void *) count);
}
@@ -1060,8 +1061,8 @@
* expression_tree_mutator directly rather than recursing to self.
*/
args = (List *) expression_tree_mutator((Node *) expr->args,
-
eval_const_expressions_mutator,
-
(void *) active_fns);
+ (Node *(*)(Node *, void *)) eval_const_expressions_mutator,
+ (void *) active_fns);
/*
* Code for op/func reduction is pretty bulky, so split it out as
@@ -1098,8 +1099,8 @@
* expression_tree_mutator directly rather than recursing to self.
*/
args = (List *) expression_tree_mutator((Node *) expr->args,
-
eval_const_expressions_mutator,
-
(void *) active_fns);
+ (Node *(*)(Node *, void*)) eval_const_expressions_mutator,
+ (void *) active_fns);
/*
* Need to get OID of underlying function. Okay to scribble on
@@ -1146,8 +1147,8 @@
* expression_tree_mutator directly rather than recursing to self.
*/
args = (List *) expression_tree_mutator((Node *) expr->args,
-
eval_const_expressions_mutator,
-
(void *) active_fns);
+ (Node *(*)(Node *, void *)) eval_const_expressions_mutator,
+ (void *) active_fns);
/*
* We must do our own check for NULLs because DistinctExpr has
@@ -1232,8 +1233,8 @@
* expression_tree_mutator directly rather than recursing to self.
*/
args = (List *) expression_tree_mutator((Node *) expr->args,
-
eval_const_expressions_mutator,
-
(void *) active_fns);
+ (Node *(*)(Node *, void *)) eval_const_expressions_mutator,
+ (void *) active_fns);
switch (expr->boolop)
{
@@ -1444,8 +1445,8 @@
/* Simplify this alternative's condition and result */
CaseWhen *casewhen = (CaseWhen *)
expression_tree_mutator((Node *) lfirst(arg),
-
eval_const_expressions_mutator,
- (void *)
active_fns);
+ (Node *(*)(Node *, void *))
eval_const_expressions_mutator,
+ (void *) active_fns);
Assert(IsA(casewhen, CaseWhen));
if (casewhen->expr == NULL ||
@@ -1589,8 +1590,9 @@
* we cannot eliminate an ArrayRef node, but we might be able to
* simplify constant expressions in its subscripts.
*/
- return expression_tree_mutator(node, eval_const_expressions_mutator,
- (void *)
active_fns);
+ return expression_tree_mutator(node,
+ (Node *(*)(Node *, void *)) eval_const_expressions_mutator,
+ (void *) active_fns);
}
/*
@@ -2022,8 +2024,9 @@
/* We don't need to copy at this time (it'll get done later) */
return nth(param->paramid - 1, context->args);
}
- return expression_tree_mutator(node, substitute_actual_parameters_mutator,
- (void *) context);
+ return expression_tree_mutator(node,
+ (Node *(*)(Node *, void *)) substitute_actual_parameters_mutator,
+ (void *) context);
}
/*
@@ -2197,9 +2200,8 @@
*/
bool
-expression_tree_walker(Node *node,
- bool (*walker) (),
- void *context)
+expression_tree_walker(Node *node, bool (*walker) (Node *node, void *context),
+ void *context)
{
List *temp;
@@ -2224,7 +2226,8 @@
/* primitive node types with no subnodes */
break;
case T_Aggref:
- return walker(((Aggref *) node)->target, context);
+ return walker((Node *)((Aggref *) node)->target,
+ context);
case T_ArrayRef:
{
ArrayRef *aref = (ArrayRef *) node;
@@ -2237,9 +2240,9 @@
walker, context))
return true;
/* walker must see the refexpr and refassgnexpr,
however */
- if (walker(aref->refexpr, context))
+ if (walker((Node *)aref->refexpr, context))
return true;
- if (walker(aref->refassgnexpr, context))
+ if (walker((Node *)aref->refassgnexpr, context))
return true;
}
break;
@@ -2318,9 +2321,11 @@
}
break;
case T_FieldSelect:
- return walker(((FieldSelect *) node)->arg, context);
+ return walker((Node *)((FieldSelect *) node)->arg,
+ context);
case T_RelabelType:
- return walker(((RelabelType *) node)->arg, context);
+ return walker((Node *)((RelabelType *) node)->arg,
+ context);
case T_CaseExpr:
{
CaseExpr *caseexpr = (CaseExpr *) node;
@@ -2331,32 +2336,41 @@
CaseWhen *when = (CaseWhen *) lfirst(temp);
Assert(IsA(when, CaseWhen));
- if (walker(when->expr, context))
+ if (walker((Node *)when->expr, context))
return true;
- if (walker(when->result, context))
+ if (walker((Node *)when->result,
+ context))
return true;
}
/* caseexpr->arg should be null, but we'll check it
anyway */
- if (walker(caseexpr->arg, context))
+ if (walker((Node *)caseexpr->arg, context))
return true;
- if (walker(caseexpr->defresult, context))
+ if (walker((Node *)caseexpr->defresult,
+ context))
return true;
}
break;
case T_ArrayExpr:
- return walker(((ArrayExpr *) node)->elements, context);
+ return walker((Node *)((ArrayExpr *) node)->elements,
+ context);
case T_CoalesceExpr:
- return walker(((CoalesceExpr *) node)->args, context);
+ return walker((Node *)((CoalesceExpr *) node)->args,
+ context);
case T_NullIfExpr:
- return walker(((NullIfExpr *) node)->args, context);
+ return walker((Node *)((NullIfExpr *) node)->args,
+ context);
case T_NullTest:
- return walker(((NullTest *) node)->arg, context);
+ return walker((Node *)((NullTest *) node)->arg,
+ context);
case T_BooleanTest:
- return walker(((BooleanTest *) node)->arg, context);
+ return walker((Node *)((BooleanTest *) node)->arg,
+ context);
case T_CoerceToDomain:
- return walker(((CoerceToDomain *) node)->arg, context);
+ return walker((Node *)((CoerceToDomain *) node)->arg,
+ context);
case T_TargetEntry:
- return walker(((TargetEntry *) node)->expr, context);
+ return walker((Node *)((TargetEntry *) node)->expr,
+ context);
case T_Query:
/* Do nothing with a sub-Query, per discussion above */
break;
@@ -2371,7 +2385,7 @@
{
FromExpr *from = (FromExpr *) node;
- if (walker(from->fromlist, context))
+ if (walker((Node *)from->fromlist, context))
return true;
if (walker(from->quals, context))
return true;
@@ -2446,10 +2460,8 @@
* indicated items. (More flag bits may be added as needed.)
*/
bool
-query_tree_walker(Query *query,
- bool (*walker) (),
- void *context,
- int flags)
+query_tree_walker(Query *query, bool (*walker) (Node *node, void *context),
+ void *context, int flags)
{
List *rt;
@@ -2467,7 +2479,7 @@
return true;
if (walker(query->limitCount, context))
return true;
- if (walker(query->in_info_list, context))
+ if (walker((Node *)query->in_info_list, context))
return true;
foreach(rt, query->rtable)
{
@@ -2481,12 +2493,14 @@
break;
case RTE_SUBQUERY:
if (!(flags & QTW_IGNORE_RT_SUBQUERIES))
- if (walker(rte->subquery, context))
+ if (walker((Node *)rte->subquery,
+ context))
return true;
break;
case RTE_JOIN:
if (!(flags & QTW_IGNORE_JOINALIASES))
- if (walker(rte->joinaliasvars, context))
+ if (walker((Node *)rte->joinaliasvars,
+ context))
return true;
break;
case RTE_FUNCTION:
@@ -2564,8 +2578,7 @@
Node *
expression_tree_mutator(Node *node,
- Node *(*mutator) (),
- void *context)
+ Node *(*mutator) (Node *node, void *context), void *context)
{
/*
* The mutator has already decided not to modify the current node, but
@@ -2929,10 +2942,8 @@
* modified substructure is safely copied in any case.
*/
Query *
-query_tree_mutator(Query *query,
- Node *(*mutator) (),
- void *context,
- int flags)
+query_tree_mutator(Query *query, Node *(*mutator) (Node *node, void *context),
+ void *context, int flags)
{
FastList newrt;
List *rt;
@@ -3000,9 +3011,7 @@
*/
bool
query_or_expression_tree_walker(Node *node,
- bool (*walker) (),
- void *context,
- int flags)
+ bool (*walker) (Node *node, void *context), void *context, int flags)
{
if (node && IsA(node, Query))
return query_tree_walker((Query *) node,
@@ -3023,9 +3032,7 @@
*/
Node *
query_or_expression_tree_mutator(Node *node,
- Node *(*mutator) (),
- void *context,
- int flags)
+ Node *(*mutator) (Node *node, void *context), void *context, int flags)
{
if (node && IsA(node, Query))
return (Node *) query_tree_mutator((Query *) node,
Index: src/backend/optimizer/util/var.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/optimizer/util/var.c,v
retrieving revision 1.55
diff -u -r1.55 var.c
--- src/backend/optimizer/util/var.c 29 Nov 2003 19:51:51 -0000 1.55
+++ src/backend/optimizer/util/var.c 12 Dec 2003 23:35:51 -0000
@@ -92,9 +92,8 @@
* if it's a Query, we don't want to increment sublevels_up.
*/
query_or_expression_tree_walker(node,
-
pull_varnos_walker,
- (void *)
&context,
- 0);
+ (bool (*)(Node *, void *)) pull_varnos_walker,
+ (void *) &context, 0);
return context.varnos;
}
@@ -118,13 +117,15 @@
bool result;
context->sublevels_up++;
- result = query_tree_walker((Query *) node, pull_varnos_walker,
- (void *) context,
0);
+ result = query_tree_walker((Query *) node,
+ (bool (*)(Node *, void *)) pull_varnos_walker,
+ (void *) context, 0);
context->sublevels_up--;
return result;
}
- return expression_tree_walker(node, pull_varnos_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) pull_varnos_walker,
+ (void *) context);
}
@@ -153,9 +154,8 @@
* if it's a Query, we don't want to increment sublevels_up.
*/
return query_or_expression_tree_walker(node,
-
contain_var_reference_walker,
-
(void *) &context,
- 0);
+ (bool (*)(Node *, void *)) contain_var_reference_walker,
+ (void *) &context, 0);
}
static bool
@@ -181,13 +181,14 @@
context->sublevels_up++;
result = query_tree_walker((Query *) node,
-
contain_var_reference_walker,
- (void *) context,
0);
+ (bool (*)(Node *, void *)) contain_var_reference_walker,
+ (void *) context, 0);
context->sublevels_up--;
return result;
}
- return expression_tree_walker(node, contain_var_reference_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) contain_var_reference_walker,
+ (void *) context);
}
@@ -250,9 +251,8 @@
int sublevels_up = levelsup;
return query_or_expression_tree_walker(node,
-
contain_vars_of_level_walker,
-
(void *) &sublevels_up,
- 0);
+ (bool (*)(Node *, void *)) contain_vars_of_level_walker,
+ (void *) &sublevels_up, 0);
}
static bool
@@ -272,15 +272,14 @@
(*sublevels_up)++;
result = query_tree_walker((Query *) node,
-
contain_vars_of_level_walker,
- (void *)
sublevels_up,
- 0);
+ (bool (*)(Node *, void *)) contain_vars_of_level_walker,
+ (void *) sublevels_up, 0);
(*sublevels_up)--;
return result;
}
return expression_tree_walker(node,
-
contain_vars_of_level_walker,
- (void *)
sublevels_up);
+ (bool (*)(Node *, void *)) contain_vars_of_level_walker,
+ (void *) sublevels_up);
}
/*
@@ -299,9 +298,8 @@
int sublevels_up = levelsup;
return query_or_expression_tree_walker(node,
-
contain_vars_above_level_walker,
-
(void *) &sublevels_up,
- 0);
+ (bool (*)(Node *, void *)) contain_vars_above_level_walker,
+ (void *) &sublevels_up, 0);
}
static bool
@@ -321,15 +319,14 @@
(*sublevels_up)++;
result = query_tree_walker((Query *) node,
-
contain_vars_above_level_walker,
- (void *)
sublevels_up,
- 0);
+ (bool (*)(Node *, void *)) contain_vars_above_level_walker,
+ (void *) sublevels_up, 0);
(*sublevels_up)--;
return result;
}
return expression_tree_walker(node,
-
contain_vars_above_level_walker,
- (void *)
sublevels_up);
+ (bool (*)(Node *, void *)) contain_vars_above_level_walker,
+ (void *) sublevels_up);
}
@@ -355,9 +352,8 @@
context.sublevels_up = 0;
(void) query_or_expression_tree_walker(node,
-
find_minimum_var_level_walker,
-
(void *) &context,
- 0);
+ (bool (*)(Node *, void *)) find_minimum_var_level_walker,
+ (void *) &context, 0);
return context.min_varlevel;
}
@@ -428,15 +424,14 @@
context->sublevels_up++;
result = query_tree_walker((Query *) node,
-
find_minimum_var_level_walker,
- (void *) context,
- 0);
+ (bool (*)(Node *, void *)) find_minimum_var_level_walker,
+ (void *) context, 0);
context->sublevels_up--;
return result;
}
return expression_tree_walker(node,
-
find_minimum_var_level_walker,
- (void *) context);
+ (bool (*)(Node *, void *)) find_minimum_var_level_walker,
+ (void *) context);
}
@@ -477,8 +472,9 @@
FastAppend(&context->varlist, node);
return false;
}
- return expression_tree_walker(node, pull_var_clause_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) pull_var_clause_walker,
+ (void *) context);
}
@@ -542,8 +538,8 @@
InClauseInfo *ininfo;
ininfo = (InClauseInfo *) expression_tree_mutator(node,
-
flatten_join_alias_vars_mutator,
-
(void *) context);
+ (Node *(*)(Node *, void *)) flatten_join_alias_vars_mutator,
+ (void *) context);
/* now fix InClauseInfo's relid sets */
if (context->sublevels_up == 0)
{
@@ -562,17 +558,17 @@
context->sublevels_up++;
newnode = query_tree_mutator((Query *) node,
-
flatten_join_alias_vars_mutator,
- (void *)
context,
-
QTW_IGNORE_JOINALIASES);
+ (Node *(*)(Node *, void *)) flatten_join_alias_vars_mutator,
+ (void *) context, QTW_IGNORE_JOINALIASES);
context->sublevels_up--;
return (Node *) newnode;
}
/* Already-planned tree not supported */
Assert(!is_subplan(node));
- return expression_tree_mutator(node, flatten_join_alias_vars_mutator,
- (void *) context);
+ return expression_tree_mutator(node,
+ (Node *(*)(Node *, void *)) flatten_join_alias_vars_mutator,
+ (void *) context);
}
/*
Index: src/backend/parser/analyze.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/parser/analyze.c,v
retrieving revision 1.292
diff -u -r1.292 analyze.c
--- src/backend/parser/analyze.c 29 Nov 2003 19:51:51 -0000 1.292
+++ src/backend/parser/analyze.c 12 Dec 2003 23:35:53 -0000
@@ -3270,9 +3270,10 @@
{
/* Recurse into RTE subquery or not-yet-planned sublink subquery */
return query_tree_walker((Query *) node,
-
check_parameter_resolution_walker,
- (void *) context, 0);
+ (bool (*)(Node *, void*))check_parameter_resolution_walker,
+ context, 0);
}
- return expression_tree_walker(node, check_parameter_resolution_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void*))check_parameter_resolution_walker,
+ context);
}
Index: src/backend/parser/parse_agg.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/parser/parse_agg.c,v
retrieving revision 1.60
diff -u -r1.60 parse_agg.c
--- src/backend/parser/parse_agg.c 29 Nov 2003 19:51:51 -0000 1.60
+++ src/backend/parser/parse_agg.c 12 Dec 2003 23:35:53 -0000
@@ -319,14 +319,14 @@
context->sublevels_up++;
result = query_tree_walker((Query *) node,
-
check_ungrouped_columns_walker,
- (void *) context,
- 0);
+ (bool (*)(Node *, void *)) check_ungrouped_columns_walker,
+ (void *) context, 0);
context->sublevels_up--;
return result;
}
- return expression_tree_walker(node, check_ungrouped_columns_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) check_ungrouped_columns_walker,
+ (void *) context);
}
/*
Index: src/backend/rewrite/rewriteDefine.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/rewrite/rewriteDefine.c,v
retrieving revision 1.91
diff -u -r1.91 rewriteDefine.c
--- src/backend/rewrite/rewriteDefine.c 29 Nov 2003 19:51:55 -0000 1.91
+++ src/backend/rewrite/rewriteDefine.c 12 Dec 2003 23:35:54 -0000
@@ -520,8 +520,9 @@
/* If there are sublinks, search for them and process their RTEs */
/* ignore subqueries in rtable because we already processed them */
if (qry->hasSubLinks)
- query_tree_walker(qry, setRuleCheckAsUser_walker, (void *) &userid,
- QTW_IGNORE_RT_SUBQUERIES);
+ query_tree_walker(qry,
+ (bool (*)(Node *, void *)) setRuleCheckAsUser_walker,
+ (void *) &userid, QTW_IGNORE_RT_SUBQUERIES);
}
/*
@@ -539,8 +540,9 @@
setRuleCheckAsUser(qry, *context);
return false;
}
- return expression_tree_walker(node, setRuleCheckAsUser_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) setRuleCheckAsUser_walker,
+ (void *) context);
}
Index: src/backend/rewrite/rewriteHandler.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/rewrite/rewriteHandler.c,v
retrieving revision 1.131
diff -u -r1.131 rewriteHandler.c
--- src/backend/rewrite/rewriteHandler.c 29 Nov 2003 19:51:55 -0000 1.131
+++ src/backend/rewrite/rewriteHandler.c 12 Dec 2003 23:35:55 -0000
@@ -758,8 +758,9 @@
* Do NOT recurse into Query nodes, because fireRIRrules already
* processed subselects of subselects for us.
*/
- return expression_tree_walker(node, fireRIRonSubLink,
- (void *) activeRIRs);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) fireRIRonSubLink,
+ (void *) activeRIRs);
}
@@ -907,8 +908,9 @@
* in the rtable.
*/
if (parsetree->hasSubLinks)
- query_tree_walker(parsetree, fireRIRonSubLink, (void *) activeRIRs,
- QTW_IGNORE_RT_SUBQUERIES);
+ query_tree_walker(parsetree,
+ (bool (*)(Node *, void *)) fireRIRonSubLink,
+ (void *) activeRIRs, QTW_IGNORE_RT_SUBQUERIES);
/*
* If the query was marked having aggregates, check if this is still
Index: src/backend/rewrite/rewriteManip.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/rewrite/rewriteManip.c,v
retrieving revision 1.81
diff -u -r1.81 rewriteManip.c
--- src/backend/rewrite/rewriteManip.c 29 Nov 2003 19:51:55 -0000 1.81
+++ src/backend/rewrite/rewriteManip.c 12 Dec 2003 23:35:55 -0000
@@ -57,9 +57,8 @@
* if it's a Query, we don't want to increment sublevels_up.
*/
return query_or_expression_tree_walker(node,
-
checkExprHasAggs_walker,
-
(void *) &context,
- 0);
+ (bool (*)(Node *, void *)) checkExprHasAggs_walker,
+ (void *) &context, 0);
}
static bool
@@ -81,13 +80,14 @@
context->sublevels_up++;
result = query_tree_walker((Query *) node,
-
checkExprHasAggs_walker,
- (void *) context,
0);
+ (bool (*)(Node *, void *)) checkExprHasAggs_walker,
+ (void *) context, 0);
context->sublevels_up--;
return result;
}
- return expression_tree_walker(node, checkExprHasAggs_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) checkExprHasAggs_walker,
+ (void *) context);
}
/*
@@ -191,13 +191,15 @@
bool result;
context->sublevels_up++;
- result = query_tree_walker((Query *) node, OffsetVarNodes_walker,
- (void *) context,
0);
+ result = query_tree_walker((Query *) node,
+ (bool (*)(Node *, void *)) OffsetVarNodes_walker,
+ (void *) context, 0);
context->sublevels_up--;
return result;
}
- return expression_tree_walker(node, OffsetVarNodes_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) OffsetVarNodes_walker,
+ (void *) context);
}
void
@@ -232,8 +234,9 @@
foreach(l, qry->rowMarks)
lfirsti(l) += offset;
}
- query_tree_walker(qry, OffsetVarNodes_walker,
- (void *) &context, 0);
+ query_tree_walker(qry,
+ (bool (*)(Node *, void *)) OffsetVarNodes_walker,
+ (void *) &context, 0);
}
else
OffsetVarNodes_walker(node, &context);
@@ -330,13 +333,15 @@
bool result;
context->sublevels_up++;
- result = query_tree_walker((Query *) node, ChangeVarNodes_walker,
- (void *) context,
0);
+ result = query_tree_walker((Query *) node,
+ (bool (*)(Node *, void *)) ChangeVarNodes_walker,
+ (void *) context, 0);
context->sublevels_up--;
return result;
}
- return expression_tree_walker(node, ChangeVarNodes_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) ChangeVarNodes_walker,
+ (void *) context);
}
void
@@ -375,8 +380,9 @@
lfirsti(l) = new_index;
}
}
- query_tree_walker(qry, ChangeVarNodes_walker,
- (void *) &context, 0);
+ query_tree_walker(qry,
+ (bool (*)(Node *, void *)) ChangeVarNodes_walker,
+ (void *) &context, 0);
}
else
ChangeVarNodes_walker(node, &context);
@@ -453,13 +459,14 @@
context->min_sublevels_up++;
result = query_tree_walker((Query *) node,
-
IncrementVarSublevelsUp_walker,
- (void *) context,
0);
+ (bool (*)(Node *, void *)) IncrementVarSublevelsUp_walker,
+ (void *) context, 0);
context->min_sublevels_up--;
return result;
}
- return expression_tree_walker(node, IncrementVarSublevelsUp_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) IncrementVarSublevelsUp_walker,
+ (void *) context);
}
void
@@ -476,9 +483,8 @@
* if it's a Query, we don't want to increment sublevels_up.
*/
query_or_expression_tree_walker(node,
-
IncrementVarSublevelsUp_walker,
- (void *)
&context,
- 0);
+ (bool (*)(Node *, void *)) IncrementVarSublevelsUp_walker,
+ (void *) &context, 0);
}
@@ -543,13 +549,15 @@
bool result;
context->sublevels_up++;
- result = query_tree_walker((Query *) node, rangeTableEntry_used_walker,
- (void *) context,
0);
+ result = query_tree_walker((Query *) node,
+ (bool (*)(Node *, void *)) rangeTableEntry_used_walker,
+ (void *) context, 0);
context->sublevels_up--;
return result;
}
- return expression_tree_walker(node, rangeTableEntry_used_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) rangeTableEntry_used_walker,
+ (void *) context);
}
bool
@@ -565,9 +573,8 @@
* if it's a Query, we don't want to increment sublevels_up.
*/
return query_or_expression_tree_walker(node,
-
rangeTableEntry_used_walker,
-
(void *) &context,
- 0);
+ (bool (*)(Node *, void *)) rangeTableEntry_used_walker,
+ (void *) &context, 0);
}
@@ -606,13 +613,15 @@
bool result;
context->sublevels_up++;
- result = query_tree_walker((Query *) node, attribute_used_walker,
- (void *) context,
0);
+ result = query_tree_walker((Query *) node,
+ (bool (*)(Node *, void *)) attribute_used_walker,
+ (void *) context, 0);
context->sublevels_up--;
return result;
}
- return expression_tree_walker(node, attribute_used_walker,
- (void *) context);
+ return expression_tree_walker(node,
+ (bool (*)(Node *, void *)) attribute_used_walker,
+ (void *) context);
}
bool
@@ -629,9 +638,8 @@
* if it's a Query, we don't want to increment sublevels_up.
*/
return query_or_expression_tree_walker(node,
-
attribute_used_walker,
-
(void *) &context,
- 0);
+ (bool (*)(Node *, void *)) attribute_used_walker,
+ (void *) &context, 0);
}
@@ -934,16 +942,16 @@
save_inserted_sublink = context->inserted_sublink;
context->inserted_sublink = false;
newnode = query_tree_mutator((Query *) node,
-
ResolveNew_mutator,
- (void *)
context,
- 0);
+ (Node *(*)(Node *, void *)) ResolveNew_mutator,
+ (void *) context, 0);
newnode->hasSubLinks |= context->inserted_sublink;
context->inserted_sublink = save_inserted_sublink;
context->sublevels_up--;
return (Node *) newnode;
}
- return expression_tree_mutator(node, ResolveNew_mutator,
- (void *) context);
+ return expression_tree_mutator(node,
+ (Node *(*)(Node *, void *)) ResolveNew_mutator,
+ (void *) context);
}
Node *
@@ -964,7 +972,6 @@
* if it's a Query, we don't want to increment sublevels_up.
*/
return query_or_expression_tree_mutator(node,
-
ResolveNew_mutator,
-
(void *) &context,
-
0);
+ (Node *(*)(Node *, void *)) ResolveNew_mutator,
+ (void *) &context, 0);
}
Index: src/include/optimizer/clauses.h
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/include/optimizer/clauses.h,v
retrieving revision 1.69
diff -u -r1.69 clauses.h
--- src/include/optimizer/clauses.h 29 Nov 2003 22:41:07 -0000 1.69
+++ src/include/optimizer/clauses.h 12 Dec 2003 23:35:59 -0000
@@ -64,24 +64,27 @@
extern Node *eval_const_expressions(Node *node);
-extern bool expression_tree_walker(Node *node, bool (*walker) (),
-
void *context);
-extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
-
void *context);
+extern bool expression_tree_walker(Node *node,
+ bool (*walker) (Node *node, void *context), void *context);
+extern Node *expression_tree_mutator(Node *node,
+ Node *(*mutator) (Node *node, void *context), void *context);
/* flags bits for query_tree_walker and query_tree_mutator */
#define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */
#define QTW_IGNORE_JOINALIASES 0x02 /* JOIN alias var lists */
#define QTW_DONT_COPY_QUERY 0x04 /* do not copy top
Query */
-extern bool query_tree_walker(Query *query, bool (*walker) (),
- void
*context, int flags);
-extern Query *query_tree_mutator(Query *query, Node *(*mutator) (),
-
void *context, int flags);
-
-extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (),
-
void *context, int flags);
-extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (),
-
void *context, int flags);
+extern bool query_tree_walker(Query *query,
+ bool (*walker) (Node *node, void *context),
+ void *context, int flags);
+extern Query *query_tree_mutator(Query *query,
+ Node *(*mutator) (Node *node, void *context),
+ void *context, int flags);
+extern bool query_or_expression_tree_walker(Node *node,
+ bool (*walker) (Node *node, void *context),
+ void *context, int flags);
+extern Node *query_or_expression_tree_mutator(Node *node,
+ Node *(*mutator) (Node *node, void *context),
+ void *context, int flags);
#endif /* CLAUSES_H */
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]