pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Cast result of copyObject() to correct type
Date: Wed, 29 Mar 2017 02:04:02 +0000
Message-ID: <E1ct2xu-0005E3-J5@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

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>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/4cb824699e12c39fad97fb3d9085ced0d14c067c

Modified Files
--------------
config/c-compiler.m4                      | 27 +++++++++++++++++++++
configure                                 | 40 +++++++++++++++++++++++++++++++
configure.in                              |  1 +
src/backend/bootstrap/bootstrap.c         |  4 ++--
src/backend/commands/copy.c               |  2 +-
src/backend/commands/createas.c           |  2 +-
src/backend/commands/event_trigger.c      |  8 +++----
src/backend/commands/prepare.c            |  4 ++--
src/backend/commands/view.c               |  2 +-
src/backend/nodes/copyfuncs.c             |  8 +++----
src/backend/optimizer/path/indxpath.c     |  4 ++--
src/backend/optimizer/plan/createplan.c   |  6 ++---
src/backend/optimizer/plan/initsplan.c    |  8 +++----
src/backend/optimizer/plan/planagg.c      |  4 ++--
src/backend/optimizer/plan/planner.c      |  4 ++--
src/backend/optimizer/plan/setrefs.c      | 26 ++++++++++----------
src/backend/optimizer/plan/subselect.c    | 14 +++++------
src/backend/optimizer/prep/prepjointree.c |  4 ++--
src/backend/optimizer/prep/preptlist.c    |  2 +-
src/backend/optimizer/prep/prepunion.c    |  4 ++--
src/backend/optimizer/util/tlist.c        | 12 +++++-----
src/backend/parser/analyze.c              |  2 +-
src/backend/parser/gram.y                 |  2 +-
src/backend/parser/parse_clause.c         |  2 +-
src/backend/parser/parse_expr.c           |  2 +-
src/backend/parser/parse_relation.c       |  2 +-
src/backend/parser/parse_utilcmd.c        |  6 ++---
src/backend/rewrite/rewriteHandler.c      |  8 +++----
src/backend/rewrite/rewriteManip.c        |  8 +++----
src/backend/tcop/postgres.c               |  6 ++---
src/backend/utils/cache/plancache.c       | 14 +++++------
src/backend/utils/cache/relcache.c        |  8 +++----
src/include/nodes/nodes.h                 |  8 ++++++-
src/include/optimizer/tlist.h             |  4 ++--
src/include/pg_config.h.in                |  6 +++++
src/include/pg_config.h.win32             |  6 +++++
36 files changed, 178 insertions(+), 92 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1ct2xu-0005E3-J5@gemulon.postgresql.org>
Permalink:  ../E1ct2xu-0005E3-J5@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ct2xu-0005E3-J5@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter_e@gmx.net
  Subject: Re: pgsql: Cast result of copyObject() to correct type
  In-Reply-To: <E1ct2xu-0005E3-J5@gemulon.postgresql.org>
  References: <E1ct2xu-0005E3-J5@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox