diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-03-09 15:18:59 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-03-28 21:59:23 -0400 |
commit | 4cb824699e12c39fad97fb3d9085ced0d14c067c (patch) | |
tree | 9a835d8efb7739e6436d3fc24b4b5a290b95df7d /src/backend/tcop/postgres.c | |
parent | 66b764341ba12206f01e2600713bdc3abdb070b3 (diff) | |
download | postgresql-4cb824699e12c39fad97fb3d9085ced0d14c067c.tar.gz postgresql-4cb824699e12c39fad97fb3d9085ced0d14c067c.zip |
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>
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 6258a14c390..3055b483b1a 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -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 |