mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +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:
@ -616,7 +616,7 @@ pg_parse_query(const char *query_string)
|
||||
#ifdef COPY_PARSE_PLAN_TREES
|
||||
/* Optional debugging check: pass raw parsetrees through copyObject() */
|
||||
{
|
||||
List *new_list = (List *) copyObject(raw_parsetree_list);
|
||||
List *new_list = copyObject(raw_parsetree_list);
|
||||
|
||||
/* This checks both copyObject() and the equal() routines... */
|
||||
if (!equal(new_list, raw_parsetree_list))
|
||||
@ -756,7 +756,7 @@ pg_rewrite_query(Query *query)
|
||||
{
|
||||
List *new_list;
|
||||
|
||||
new_list = (List *) copyObject(querytree_list);
|
||||
new_list = copyObject(querytree_list);
|
||||
/* This checks both copyObject() and the equal() routines... */
|
||||
if (!equal(new_list, querytree_list))
|
||||
elog(WARNING, "copyObject() failed to produce equal parse tree");
|
||||
@ -803,7 +803,7 @@ pg_plan_query(Query *querytree, int cursorOptions, ParamListInfo boundParams)
|
||||
#ifdef COPY_PARSE_PLAN_TREES
|
||||
/* Optional debugging check: pass plan output through copyObject() */
|
||||
{
|
||||
PlannedStmt *new_plan = (PlannedStmt *) copyObject(plan);
|
||||
PlannedStmt *new_plan = copyObject(plan);
|
||||
|
||||
/*
|
||||
* equal() currently does not have routines to compare Plan nodes, so
|
||||
|
Reference in New Issue
Block a user